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 

Change col value based on another column in SORT

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


Joined: 16 Nov 2004
Posts: 2
Topics: 1

PostPosted: Tue Nov 16, 2004 7:25 am    Post subject: Change col value based on another column in SORT Reply with quote

In a file, on Col 8, I can have values ranging from 1 to 5. During SORT, i shld chk col 8 for 5 and populate Col 10 with Y and for other values of Col 8, i should populate Col 10 with N"..what is the sort card for this

Thanks
Raju
Back to top
View user's profile Send private message
Phantom
Data Mgmt Moderator
Data Mgmt Moderator


Joined: 07 Jan 2003
Posts: 1056
Topics: 91
Location: The Blue Planet

PostPosted: Tue Nov 16, 2004 7:34 am    Post subject: Reply with quote

Raju,

The following sort job will do the needful,

Code:

//R010     EXEC PGM=SORT
//SYSOUT   DD SYSOUT=*
//SORTIN   DD DSN=YOUR.INPUT.FILE,
//            DISP=SHR
//SORTOUT  DD DSN=YOUT.OUTPUT.FILE,
//            DISP=(NEW,CATLG,DELETE),
//            UNIT=SYSDA,
//            SPACE=(CYL,(X,Y),RLSE),
//SYSIN    DD *
  SORT FIELDS=COPY
  OUTREC FIELDS=(1,9,
                 8,1,CHANGE=(1,C'5',C'Y'),NOMATCH=(C'N'),
                 11,70)
/*

Here is a short explanation of the job.
1. Copy 1 to 9 bytes from the input file as such.
2. In 10th position of the output file copy the 8th column from the input file and use CHANGE command to do the IF-THEN-ELSE replacements as you requested.
3. Copy the remaining data i.e from 11 to end of record. Note: I assumed that the input file is RECFM=FB and LRECL=80. You need to change the job to support your needs.

Hope this helps,
Phantom
Back to top
View user's profile Send private message
Raju1
Beginner


Joined: 16 Nov 2004
Posts: 2
Topics: 1

PostPosted: Tue Nov 16, 2004 8:34 am    Post subject: Reply with quote

Thanks Phantom
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 -> Utilities 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