Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Profile Log in to check your private messages Log in
 
How to SORT when records are spanned on next line.

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

New User


Joined: 27 Jul 2007
Posts: 33
Location: mumbai

PostPosted: Thu Apr 28, 2011 11:44 pm    Post subject: How to SORT when records are spanned on next line.
Reply with quote

Hi,

Could you please help me in achieving the below output?
The input records are as given in the below structure. The input is continued into the next line, the last field starts at position 25 and continues onto the next line again at 25, and i want to sort the input based on the first field i.e. 001,002 etc. The expected output is as shwn below.

Can this functionality be implemented using ICETOOL.

Code:

Input:

1----5----10----15----20----25----30
004  PETER      AMERICA     LOVES
                            LIFE
003  SAM        UK          LOVES
                            LIFE
001  RONALD     AUSTRALIA   HATES
                            LIFE
002  KATE       AFRICA      HATES
                            LIFE
005  WILLIAM    IRELAND     HATES
                            LIFE

Output:

1----5----10----15----20----25----30
001  RONALD     AUSTRALIA   HATES
                            LIFE
002  KATE       AFRICA      HATES
                            LIFE
003  SAM        UK          LOVES
                            LIFE
004  PETER      AMERICA     LOVES
                            LIFE
005  WILLIAM    IRELAND     HATES
                            LIFE


 
Back to top
View user's profile Send private message

Skolusu

Senior Member


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

PostPosted: Fri Apr 29, 2011 12:00 am    Post subject: Reply to: How to SORT when records are spanned on next line.
Reply with quote

vaibhavjadhav,

Assuming your input is FB, LRECL=30 and the continuation line has a space in the first byte, the following DFSORT JCL will give you the desired results.

Code:

//STEP0100 EXEC PGM=SORT           
//SYSOUT   DD SYSOUT=*             
//SORTIN   DD DSN=Your input FB 30 byte file,DISP=SHR
//SORTOUT  DD SYSOUT=*                                           
//SYSIN    DD *                                                 
  INREC IFTHEN=(WHEN=GROUP,BEGIN=(1,1,CH,NE,C' '),PUSH=(31:1,3))
  SORT FIELDS=(31,03,CH,A),EQUALS                               
  OUTREC BUILD=(1,30)                                           
//*
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 Sort numeric fields with trailing spaces sancraig16 SYNCSORT 7 Tue Apr 03, 2018 1:21 am
No new posts Extract the records with a PD field's... sudhakar84 DFSORT/ICETOOL 11 Mon Apr 02, 2018 7:26 pm
No new posts Find & Replace string in CA-SORT mrgnndhmk CA Products 1 Fri Mar 30, 2018 12:58 am
No new posts Merge 2 records sancraig16 SYNCSORT 19 Tue Mar 27, 2018 8:17 pm
No new posts SORT 3 files,extract specific fields ... Kiransr DFSORT/ICETOOL 13 Fri Mar 23, 2018 10:54 am

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us