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
 

 

Best sort approach needed

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> JCL & VSAM
View previous topic :: :: View next topic  
Author Message
arundvarma

New User


Joined: 23 Oct 2003
Posts: 6

PostPosted: Tue Dec 23, 2003 3:33 pm    Post subject: Best sort approach needed
Reply with quote

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
Back to top
View user's profile Send private message

sandip_datta

Active User


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

PostPosted: Fri Dec 26, 2003 1:32 pm    Post subject:
Reply with quote

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.
Back to top
View user's profile Send private message
sandip_datta

Active User


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

PostPosted: Fri Dec 26, 2003 1:34 pm    Post subject:
Reply with quote

I am sorry...Please change the SORTOUT dataset name appropriately...
icon_redface.gif
Regards,
Sandip.
Back to top
View user's profile Send private message
arundvarma

New User


Joined: 23 Oct 2003
Posts: 6

PostPosted: Mon Dec 29, 2003 11:49 am    Post subject:
Reply with quote

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
Back to top
View user's profile Send private message
sandip_datta

Active User


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

PostPosted: Tue Dec 30, 2003 6:04 pm    Post subject:
Reply with quote

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. icon_razz.gif
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 -> JCL & VSAM All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts How to change 'K' or 'M' use Sort vice_versa DFSORT/ICETOOL 5 Thu May 18, 2017 7:11 am
No new posts Adding big TEXT lines to each record ... bshkris SYNCSORT 4 Sat May 06, 2017 1:40 am
This topic is locked: you cannot edit posts or make replies. SORT trick needed bshkris SYNCSORT 6 Tue May 02, 2017 4:35 am
No new posts SORT JSON type of data maxsubrat DFSORT/ICETOOL 8 Wed Apr 19, 2017 6:01 pm
No new posts Sort Large record length cmsmoon DFSORT/ICETOOL 14 Tue Apr 11, 2017 5:49 pm


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