Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref

Author Message
arundvarma

New User

Joined: 23 Oct 2003
Posts: 6

 Posted: Tue Dec 23, 2003 3:33 pm    Post subject: Best sort approach needed I have a situation like this... code: -------------------------------------------------------------------------------- Cust-num ch-no 539112 111111111111 867324 222222222222 bbbbbb 3333333333333 120934 444444444444 bbbbbb 555555555555 974213 666666666666 -------------------------------------------------------------------------------- The expected output is as follows.. code: -------------------------------------------------------------------------------- Cust-num ch-no NEW-cust-num 539112 111111111111 0000539112 867324 222222222222 0000867324 bbbbbb 333333333333 bbbbbbbbbb 312093 444444444444 0000312093 bbbbbb 555555555555 bbbbbbbbbb 974213 666666666666 0000974213 -------------------------------------------------------------------------------- If you see the out put..we have a new customer number field which is nothing but 4 zeros+old customer number field.Here the fact to be considered is that if the old customer number field consists of spaces(bbbbbb in this case) then the new customer number should also have spaces. FOR YOUR INFORMATION...The old cust num field starts from 6 to 11 and ch-no starts from 13 to 24 and new cust no field starts from 26th position. The sorting is done on a field not mentioned here..It will be the first 4 characters called as job number field.So Please frame the best and minimum sort steps to achieve the same output considering all the above mentioned. Thanks & regards, Arun

sandip_datta

Active User

Joined: 02 Dec 2003
Posts: 151
Location: Tokyo, Japan

Posted: Fri Dec 26, 2003 1:32 pm    Post subject:

Hello Arun,

Can you try following SORT Job? I have assumed the input file as FB and of length 80.

 Code: //S1    EXEC PGM=SORT //SORTIN  DD * AAAA 539112 111111111111 DDDD 867324 222222222222 BBBB        3333333333333 CCCC 120934 444444444444 FFFF        555555555555 EEEE 974213 666666666666 /* //SORTOUT DD DSN=RJPIBF.JP00395.OUT,DISP=(NEW,CATLG,DELETE), //           DCB=(RECFM=FB,LRECL=80,BLKSIZE=0), //           SPACE=(CYL,(4,1),RLSE) //SORTLIB  DD  DSN=SYS1.SORTLIB, //            DISP=SHR //SORTWK01 DD  UNIT=DISK,SPACE=(CYL,01,,CONTIG) //SORTWK02 DD  UNIT=DISK,SPACE=(CYL,01,,CONTIG) //SYSOUT   DD  SYSOUT=* //SYSIN    DD  *    INREC  FIELDS=(1,24,C' 0000',6,6)    SORT   FIELDS=(1,4,CH,A)    OUTREC FIELDS=(1,25,26,10,                   CHANGE=(10,C'0000      ',C'          '),                   NOMATCH=(26,10)) /*

Hope this helps.

Regards,
Sandip.
sandip_datta

Active User

Joined: 02 Dec 2003
Posts: 151
Location: Tokyo, Japan

 Posted: Fri Dec 26, 2003 1:34 pm    Post subject: I am sorry...Please change the SORTOUT dataset name appropriately... Regards, Sandip.
arundvarma

New User

Joined: 23 Oct 2003
Posts: 6

 Posted: Mon Dec 29, 2003 11:49 am    Post subject: Hi Sandip, Thanks a ton for the reply.Well I had changed the Sortout dataset .So no props.Well could u pls explain the steps too.Its enough if u brief it out in 1 or 2 sentences..Y r u using inrec and outrec fields both. Thanks and regards, Arun.D
sandip_datta

Active User

Joined: 02 Dec 2003
Posts: 151
Location: Tokyo, Japan

 Posted: Tue Dec 30, 2003 6:04 pm    Post subject: Hello Arun, INREC is used to modifu the data - put 0000 before particular field. OUTREC is used to Change the New value according to your requirement i.e., SPACE. Mind it if you don't know - During INREC always refer to the position as of formatted output. During OUTREC always refer to the position as of original input. Regards, Sandip.
 All times are GMT + 6 Hours
 Page 1 of 1

Search our Forum:

 Topic Author Forum Replies Posted Similar Topics Sort numeric fields with trailing spaces sancraig16 SYNCSORT 7 Tue Apr 03, 2018 1:21 am Find & Replace string in CA-SORT mrgnndhmk CA Products 1 Fri Mar 30, 2018 12:58 am SORT 3 files,extract specific fields ... Kiransr DFSORT/ICETOOL 13 Fri Mar 23, 2018 10:54 am How to Generate JCL using Sort naveen katkuri DFSORT/ICETOOL 7 Tue Mar 13, 2018 3:50 pm Need better approach to create a sort... Vamshi Veludandi DFSORT/ICETOOL 8 Thu Mar 08, 2018 5:59 pm

 © 2003-2017 IBM MAINFRAME Software Support Division
 Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us