MVSFORUMS.com Forum Index MVSFORUMS.com
A Community of and for MVS Professionals
 
 FAQFAQ   SearchSearch   Quick Manuals   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

SPUFI Update Table Columns

 
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Database
View previous topic :: View next topic  
Author Message
NorthernDancer
Beginner


Joined: 01 May 2007
Posts: 44
Topics: 22
Location: DOWNTOWN BUFFALO, NY

PostPosted: Fri Feb 26, 2016 11:17 am    Post subject: SPUFI Update Table Columns Reply with quote

I want to use SPUFI if possible to plug some columns with test data. And I want to Concatenate like parts of 2 existing columns together. So the new data becomes easily recognized. Say for example 1st 5 bytes of ZIPCODE concatenated with 1st 10 bytes of CityName. Would I just use the Concatenate character (whatever that is) between them on the SET ?? So then maybe SET HUBID = ZIPCODE(1:5)|CityName(1:10) ??
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12357
Topics: 75
Location: San Jose

PostPosted: Fri Feb 26, 2016 12:11 pm    Post subject: Reply with quote

NorthernDancer,

You can do it quite easily as long as the target and source columns have the same attributes. If you have different attributes then you need to convert the source column to match target column attributes.

Check this link for examples

http://www.mvsforums.com/helpboards/viewtopic.php?p=58823#58823
_________________
Kolusu - DFSORT Development Team (IBM)
DFSORT is on the Web at:
www.ibm.com/storage/dfsort

www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
NorthernDancer
Beginner


Joined: 01 May 2007
Posts: 44
Topics: 22
Location: DOWNTOWN BUFFALO, NY

PostPosted: Mon Feb 29, 2016 3:49 pm    Post subject: Reply with quote

Thank You Sir, this is it easily as you said..............
Code:

UPDATE DB2T.OUR_CUST                                   
SET HUB_CUST_ID =                                     
CHAR('HUB-'||SUBSTR(ZIP_OR_POSTAL_CDE,1,5)||CHAR('-')||
SUBSTR(CIN_CUST_ID,1,9))                               
WHERE                                                 
ENTY_ID = 'YYYY' AND                                   
AREA_ID = 'ZZZZ' AND                                   
CIN_CUST_ID > '  ' AND                                 
CIN_CUST_ID < '000061836' AND                         
ZIP_OR_POSTAL_CDE > '  ' AND                           
ADR_LINE_3 > '  ' AND                                   
HUB_CUST_ID = '  ' AND                                 
EXPR_DTE = '9999-12-31'                               
;
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12357
Topics: 75
Location: San Jose

PostPosted: Mon Feb 29, 2016 6:48 pm    Post subject: Reply with quote

NorthernDancer,

Glad you got it working but I would suggest you code the sql's so that easy to read and understand. Something like this
Code:

----+----1----+----2----+----3----+----4----+----5----+----6
UPDATE DB2T.OUR_CUST                                       
   SET HUB_CUST_ID       = CHAR(('HUB-')                 ||
                           SUBSTR(ZIP_OR_POSTAL_CDE,1,5) ||
                           CHAR('-')                     ||
                           SUBSTR(CIN_CUST_ID,1,9))         
 WHERE ENTY_ID           = 'YYYY'                           
   AND AREA_ID           = 'ZZZZ'                           
   AND CIN_CUST_ID       > '  '                             
   AND CIN_CUST_ID       < '000061836'                     
   AND ZIP_OR_POSTAL_CDE > '  '                             
   AND ADR_LINE_3        > '  '                             
   AND HUB_CUST_ID       = '  '                             
   AND EXPR_DTE          = '9999-12-31'                     
   ;                                                       

_________________
Kolusu - DFSORT Development Team (IBM)
DFSORT is on the Web at:
www.ibm.com/storage/dfsort

www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
NorthernDancer
Beginner


Joined: 01 May 2007
Posts: 44
Topics: 22
Location: DOWNTOWN BUFFALO, NY

PostPosted: Tue Mar 01, 2016 4:31 pm    Post subject: Reply with quote

Yeh, I just slapped it together to test it and zap some test rows. I like your way a lot better and neater. I didn't actually know you could leave so many blanks on separate cards and it still parses together OK. Idea
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Database All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


MVSFORUMS
Powered by phpBB © 2001, 2005 phpBB Group