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

Omit certain fields in middle of a record


IBM Mainframe Forums -> DFSORT/ICETOOL
Post new topic   Reply to topic
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
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
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
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
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 View Bookmarks
All times are GMT + 6 Hours
Forum Index -> DFSORT/ICETOOL

 


Similar Topics
Topic Forum Replies
No new posts How to split large record length file... DFSORT/ICETOOL 10
No new posts INCLUDE OMIT COND for Multiple values... DFSORT/ICETOOL 5
No new posts SFTP Issue - destination file record ... All Other Mainframe Topics 2
No new posts FINDREP - Only first record from give... DFSORT/ICETOOL 3
No new posts To find whether record count are true... DFSORT/ICETOOL 6
Search our Forums:

Back to Top