IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

Reformatting of O/P file based on I/P value


IBM Mainframe Forums -> DFSORT/ICETOOL
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
Debasis Misra
Warnings : 1

New User


Joined: 16 Sep 2008
Posts: 72
Location: Bangalore

PostPosted: Tue Aug 10, 2010 11:09 pm
Reply with quote

I have an I/P file like following :

1CNCLABC123
2DCHGBCD456
3CNCLABC456
4DCHGBCD123

Layout :
1st byte = Sequence no
2-5 byte = Category
6-8 byte = Code1
9-11 byte = Code2

Requirement:
O/P file should contain only Category and Code, total 7 bytes in length.
If category = 'CNCL' ------> then code = Code1 (6-8 byte)
If Category = 'DCHG' -----> then code = Code2 (9-11 byte).

Please help me to do this one using SORT utility.
Back to top
View user's profile Send private message
Skolusu

Senior Member


Joined: 07 Dec 2007
Posts: 2205
Location: San Jose

PostPosted: Tue Aug 10, 2010 11:14 pm
Reply with quote

Debasis Misra,

Code:

//STEP0100 EXEC PGM=SORT                           
//SYSOUT   DD SYSOUT=*                             
//SORTIN   DD *                                   
1CNCLABC123                                       
2DCHGBCD456                                       
3CNCLABC456                                       
4DCHGBCD123                                       
//SORTOUT  DD SYSOUT=*                             
//SYSIN    DD *
  INCLUDE COND=(2,4,SS,EQ,C'CNCL,DCHG')                                     
  SORT FIELDS=COPY                                 
  INREC IFOUTLEN=7,                               
  IFTHEN=(WHEN=(2,4,CH,EQ,C'CNCL'),BUILD=(2,7)),   
  IFTHEN=(WHEN=(2,4,CH,EQ,C'DCHG'),BUILD=(2,4,9,3))
//*                                               
Back to top
View user's profile Send private message
Debasis Misra
Warnings : 1

New User


Joined: 16 Sep 2008
Posts: 72
Location: Bangalore

PostPosted: Tue Aug 10, 2010 11:24 pm
Reply with quote

Thanks a lot!, its working, I have tried now.
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> DFSORT/ICETOOL

 


Similar Topics
Topic Forum Replies
No new posts FTP VB File from Mainframe retaining ... JCL & VSAM 6
No new posts Extract the file name from another fi... DFSORT/ICETOOL 6
No new posts How to split large record length file... DFSORT/ICETOOL 10
No new posts Extracting Variable decimal numbers f... DFSORT/ICETOOL 17
No new posts SFTP Issue - destination file record ... All Other Mainframe Topics 2
Search our Forums:

Back to Top