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

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


IBM Mainframe Forums -> COBOL Programming
Post new topic   Reply to topic
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
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: 2481
Location: @my desk

PostPosted: Wed Dec 03, 2008 5:34 pm
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
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: 2481
Location: @my desk

PostPosted: Thu Dec 04, 2008 9:56 am
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: 2481
Location: @my desk

PostPosted: Thu Dec 04, 2008 11:01 am
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 View Bookmarks
All times are GMT + 6 Hours
Forum Index -> COBOL Programming

 


Similar Topics
Topic Forum Replies
No new posts FTP VB File from Mainframe retaining ... JCL & VSAM 8
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