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

Best sort approach needed


IBM Mainframe Forums -> JCL & VSAM
Post new topic   Reply to topic
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
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: 150
Location: Tokyo, Japan

PostPosted: Fri Dec 26, 2003 1:32 pm
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: 150
Location: Tokyo, Japan

PostPosted: Fri Dec 26, 2003 1:34 pm
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
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: 150
Location: Tokyo, Japan

PostPosted: Tue Dec 30, 2003 6:04 pm
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 View Bookmarks
All times are GMT + 6 Hours
Forum Index -> JCL & VSAM

 


Similar Topics
Topic Forum Replies
No new posts Need to set RC4 through JCL SORT DFSORT/ICETOOL 5
No new posts How to split large record length file... DFSORT/ICETOOL 10
No new posts JCL sort card - get first day and las... JCL & VSAM 9
No new posts Sort First/last record of a subset th... DFSORT/ICETOOL 7
No new posts how to calculate SUM value for VB fil... DFSORT/ICETOOL 1
Search our Forums:

Back to Top