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
 

 

Sorting a file-which contains a set of lines as a single Rec

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming
View previous topic :: :: View next topic  
Author Message
mk_kumar315

New User


Joined: 21 Nov 2005
Posts: 10

PostPosted: Wed Dec 03, 2008 5:23 pm    Post subject: Sorting a file-which contains a set of lines as a single Rec
Reply with quote

Hi,

I need to sort a file which contains the records as set of lines.

I/P:
0010BBBBB AAA Navigation-Incl trolley
luggage, bags
Tyres,support
0010BBBBB ZZZZZZyard Navigation-Incl lights
new one, support
radio, airconditioning
0010BBBBB MMMMMMMMMMyard Navigation-Incl lights
old one, support
airconditioning
0010BBBBB BBBBBBByard Navigation-Incl lights
common one, support
tape, airconditioning
0010BBBBB AAAAAAAAAAyard Navigation-Incl lights
0010BBBBB KKKKKKyard Navigation-Incl lights

Expected O/P :

0010BBBBB AAA Navigation-Incl trolley
luggage, bags
tyres,support
0010BBBBB AAAAAAAAAAyard Navigation-Incl lights
0010BBBBB BBBBBBByard Navigation-Incl lights
common one, support
tape, airconditioning
0010BBBBB KKKKKKyard Navigation-Incl lights
0010BBBBB MMMMMMMMMMyard Navigation-Incl lights
old one, support
airconditioning
0010BBBBB ZZZZZZyard Navigation-Incl lights
new one, support
radio, airconditioning

Here we need to sort the 2nd column and we need to write the output file with that set of records....

first record :

0010BBBBB AAA Navigation-Incl trolley
luggage, bags
tyres,support
and then the second record:

0010BBBBB AAAAAAAAAAyard Navigation-Incl lights

if i use simple sort then the output for the set of records is not possible.

M.K.Kumar
Back to top
View user's profile Send private message

Arun Raj

Moderator


Joined: 17 Oct 2006
Posts: 2180
Location: @my desk

PostPosted: Wed Dec 03, 2008 5:34 pm    Post subject:
Reply with quote

mk_kumar315,

Are you looking for a COBOL Solution? icon_rolleyes.gif
Back to top
View user's profile Send private message
mk_kumar315

New User


Joined: 21 Nov 2005
Posts: 10

PostPosted: Thu Dec 04, 2008 9:42 am    Post subject: Reply to: Sorting a file-which contains a set of lines as a
Reply with quote

Yes,i believe it is possible with COBOL only
Please let me know is there any other method by using JCL.

Here I need to sort the 2 column of i/p file after the KEY and based on that i need write the set of lines of records to the output.The set of lines are considered as 1 record and its length may be 3 or 4 continuous lines.

Thanks in Advance,
MK.Kumar.
Back to top
View user's profile Send private message
Arun Raj

Moderator


Joined: 17 Oct 2006
Posts: 2180
Location: @my desk

PostPosted: Thu Dec 04, 2008 9:56 am    Post subject:
Reply with quote

mk_kumar315,

Are all the "groups" having '0010' in pos 1-4 or do you expect other values also?
Back to top
View user's profile Send private message
Arun Raj

Moderator


Joined: 17 Oct 2006
Posts: 2180
Location: @my desk

PostPosted: Thu Dec 04, 2008 11:01 am    Post subject:
Reply with quote

Quote:
Please let me know is there any other method by using JCL.
mk_kumar315,

If you have Syncsort, you can try out the below job. This assumes an input file of LRECL 80. You can modify it as per your file attributes.
Code:
//STEP1    EXEC PGM=SYNCTOOL                     
//IN       DD DSN= input-file ---- FB,LRECL=80   
//DFSMSG   DD SYSOUT=*                           
//TOOLMSG  DD SYSOUT=*                           
//T1       DD DSN=&&T1,DISP=(,PASS)             
//OUT      DD SYSOUT=*                           
//TOOLIN   DD *                                                       
  SPLICE FROM(IN) TO(T1) ON(89,8,CH) WITH(1,88) WITHALL -             
                  KEEPBASE KEEPNODUPS USING(CTL1)                     
  SORT FROM(T1) TO(OUT) USING(CTL2)                                   
//CTL1CNTL DD *                                                       
  INREC IFTHEN=(WHEN=INIT,OVERLAY=(81:SEQNUM,8,ZD)),                 
        IFTHEN=(WHEN=(1,4,CH,EQ,C'0010'),                             
         OVERLAY=(89:SEQNUM,8,ZD,97:11,70)),                         
        IFTHEN=(WHEN=NONE,                                           
         OVERLAY=(89:SEQNUM,8,ZD,89:89,8,ZD,SUB,81,8,ZD,M11,LENGTH=8))
  OUTFIL FNAMES=T1                                                   
//CTL2CNTL DD *                                                       
  SORT FIELDS=(97,70,CH,A,81,8,CH,A)                                 
  OUTFIL FNAMES=OUT,BUILD=(1,80)
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 -> COBOL Programming All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts SORTJOIN - Copy Matched and Unmatched... Steve Ironmonger DFSORT/ICETOOL 5 Tue Jan 17, 2017 4:26 pm
No new posts Copy RECFM =VB TO FB file with RECL =... sahil41352 DFSORT/ICETOOL 3 Wed Dec 28, 2016 11:29 pm
No new posts syncsort: copy lines after the keyword shreya19 SYNCSORT 7 Fri Dec 02, 2016 9:47 am
No new posts Add PD field from 2nd file to PD in 1st Sushant Garje DFSORT/ICETOOL 6 Thu Dec 01, 2016 4:32 pm
No new posts File Aid to File Manager conversion murali3955 IBM Tools 4 Thu Nov 24, 2016 3:41 pm


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