Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

Omit certain fields in middle of a record

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
View previous topic :: :: View next topic  
Author Message
Bhargav_1058

New User


Joined: 13 Dec 2008
Posts: 53
Location: New York

PostPosted: Wed Feb 29, 2012 9:55 pm    Post subject: Omit certain fields in middle of a record
Reply with quote

Hi,

My input file will Key delimited by '|' numerics delimited by '|' amount as shown below. Is there a way to omit the numerics in input file using sort and write an output with Key delimited by '|' and amount? (LRECL=80 and its an FB file).

Input
Code:
ABCD|05|-1
ABED|1|-2
ADCD|004|15.00
ABCD|0003|-2


Required Output
Code:
ABCD|-1
ABED|-2
ADCD|15.00
ABCD|-2


Please suggest if this could be achieved.
Back to top
View user's profile Send private message

elango_K

New User


Joined: 18 Aug 2011
Posts: 44
Location: India

PostPosted: Wed Feb 29, 2012 10:07 pm    Post subject:
Reply with quote

This is certainly possible using 'PARSE' command in DFSORT.

Code:

//SORTIN   DD *                                                       
ABCD|05|-1                                                             
ABED|1|-2                                                             
ADCD|004|15.00                                                         
ABCD|0003|-2                                                           
//SYSOUT   DD SYSOUT=*                                                 
//SYSUDUMP DD SYSOUT=*                                                 
//DFSMSG   DD SYSOUT=*                                                 
//SORTOUT  DD SYSOUT=*                                                 
//SYSIN    DD *                                                       
 OPTION COPY                                                           
 INREC PARSE=(%01=(ENDBEFR=C'|',FIXLEN=9),%02=(ENDBEFR=C'|',FIXLEN=9),
              %03=(FIXLEN=9)),                                         
 BUILD=(%01,C'|',%03,80:X)                                             
 OUTREC BUILD=(1,80,SQZ=(SHIFT=LEFT))                                 
/*                                                                     


Output
Code:

ABCD|-1   
ABED|-2   
ADCD|15.00
ABCD|-2   
Back to top
View user's profile Send private message
Skolusu

Senior Member


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

PostPosted: Wed Feb 29, 2012 10:21 pm    Post subject:
Reply with quote

bhargav_1058,

Use the following DFSORT JCL. I assumed your Key to be 4 bytes and the other data is 75 bytes. key of 4 bytes+delimiter+75=80 bytes
Code:

//STEP0100 EXEC PGM=SORT                               
//SYSOUT   DD SYSOUT=*                                 
//SORTIN   DD *                                         
ABCD|05|-1                                             
ABED|1|-2                                               
ADCD|004|15.00                                         
ABCD|0003|-2                                           
//SORTOUT  DD SYSOUT=*                                 
//SYSIN    DD *                                         
  OPTION COPY
  INREC PARSE=(%01=(ENDAT=C'|',FIXLEN=5),%=(ENDAT=C'|'),
               %02=(FIXLEN=75)),BUILD=(%01,%02)
//*
Back to top
View user's profile Send private message
Bhargav_1058

New User


Joined: 13 Dec 2008
Posts: 53
Location: New York

PostPosted: Thu Mar 01, 2012 12:09 am    Post subject:
Reply with quote

Both sorts gave the desired output. Thanks to both of you for your help Skolusu and Elango...

If I understand correctly...
The %01 parsed field is used to extract the first variable field into an 5-byte fixed parsed field.
The % parsed field is used to skip the second variable field without extracting anything for it, since we don't want this field in the output record. And build the output file with %01 and %02.

I'm glad icon_biggrin.gif... I learned something new today.
This information can also be found here http://publib.boulder.ibm.com/infocenter/zos/v1r11/index.jsp?topic=/com.ibm.zos.r11.iceg200/ice1cg4028.htm
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Validate date and numeric fields and ... Rick Silvers DFSORT/ICETOOL 6 Thu May 11, 2017 6:51 pm
No new posts Adding big TEXT lines to each record ... bshkris SYNCSORT 4 Sat May 06, 2017 1:40 am
This topic is locked: you cannot edit posts or make replies. Merge two files and update Trailer re... Yashashri JCL & VSAM 1 Thu May 04, 2017 12:54 pm
No new posts Sum Fields ballaswaroop DFSORT/ICETOOL 4 Tue May 02, 2017 11:07 am
No new posts Sort Large record length cmsmoon DFSORT/ICETOOL 14 Tue Apr 11, 2017 5:49 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us