|
View previous topic :: View next topic
|
| Author |
Message |
arundvarma
New User
Joined: 23 Oct 2003 Posts: 6
|
|
|
|
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 |
|
 |
sandip_datta
Active User

Joined: 02 Dec 2003 Posts: 150 Location: Tokyo, Japan
|
|
|
|
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 |
|
 |
sandip_datta
Active User

Joined: 02 Dec 2003 Posts: 150 Location: Tokyo, Japan
|
|
|
|
I am sorry...Please change the SORTOUT dataset name appropriately...
Regards,
Sandip. |
|
| Back to top |
|
 |
arundvarma
New User
Joined: 23 Oct 2003 Posts: 6
|
|
|
|
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 |
|
 |
sandip_datta
Active User

Joined: 02 Dec 2003 Posts: 150 Location: Tokyo, Japan
|
|
|
|
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.  |
|
| Back to top |
|
 |
|
|
 |
All times are GMT + 6 Hours |
|