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
 
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: 2285
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: 2285
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: 2285
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 Compare yesterday's date to the one o... migusd SYNCSORT 8 Fri Sep 22, 2017 11:35 pm
No new posts Split 1 file into 10 output Files - S... Prasanth Kumar SYNCSORT 5 Sat Sep 16, 2017 12:02 am
No new posts More than 1 Include criteria for sing... Roy Ware SYNCSORT 6 Wed Sep 13, 2017 11:45 pm
No new posts BUILD OUTFIL based on condition other... balaji81_k DFSORT/ICETOOL 13 Fri Sep 08, 2017 11:06 pm
No new posts Skip file from delete pema_yozer All Other Mainframe Topics 3 Tue Aug 29, 2017 3:19 pm

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