|
View previous topic :: View next topic
|
| Author |
Message |
kitchu84
New User
Joined: 02 Dec 2006 Posts: 33 Location: chennai
|
|
|
|
Hi All,
I have a requirement tp assign sequence no to two different files with same DCB parameter: LRECL=4900, RECFM=FB
Need to assign continous sequence number to these files at different positions
File1: LRECL=4900, RECFM=FB with record type as 'P'(position 1).
Assign 12 byte sequence number at positon 2406
File2: LRECL=4900, RECFM=FB with record type as 'B' (position 1).
Assign 12 byte sequence number at position 3406. The sequence number assigned to this file should start from the next available sequence number from file1.
Desired output
-----------------
2406 pos 3406 pos
Pxyz............000000000001
Pjkjkj..........000000000002
Bjkjkj....................................000000000003
Babcd....................................000000000004
Please advise. |
|
| Back to top |
|
 |
Skolusu
Senior Member
Joined: 07 Dec 2007 Posts: 2205 Location: San Jose
|
|
|
|
Kitchu84,
Concatenate both input files to sortin and use the following DFSORT JCL
| Code: |
//STEP0100 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SORTIN DD DSN=Your input file1,DISP=SHR
// DD DSN=Your input file2,DISP=SHR
//SORTOUT DD SYSOUT=*
//SYSIN DD *
SORT FIELDS=COPY
INREC IFOUTLEN=4900,IFTHEN=(WHEN=(1,1,SS,EQ,C'P,B'),
OVERLAY=(4901:SEQNUM,12,ZD),HIT=NEXT),
IFTHEN=(WHEN=(1,1,CH,EQ,C'P'),OVERLAY=(2406:4901,12)),
IFTHEN=(WHEN=(1,1,CH,EQ,C'B'),OVERLAY=(3406:4901,12))
//* |
|
|
| Back to top |
|
 |
kitchu84
New User
Joined: 02 Dec 2006 Posts: 33 Location: chennai
|
|
|
|
Thanks you soooooooooooooooooo much Skolusu ... its working perfectly ... I never knew about this capability ...
 ...
thanks again! |
|
| Back to top |
|
 |
kitchu84
New User
Joined: 02 Dec 2006 Posts: 33 Location: chennai
|
|
|
|
hello Skolusu,
I also wanted to know
1. what does this mean:
"IFTHEN=(WHEN=(1,1,SS,EQ,C'P,B')" - Is there any significance of 'SS' here
2. Also, if in the sequence number i need to have numbering like N00000000001
N00000000002
N00000000003
....................
....................
N000000000090
(sequence is 12 bytes and the first letter is always N).
Please advise. |
|
| Back to top |
|
 |
Skolusu
Senior Member
Joined: 07 Dec 2007 Posts: 2205 Location: San Jose
|
|
|
|
| Quote: |
| .Is there any significance of 'SS' here |
kitchu84,
Substring(SS) format is used to check multiple values or find a value anywhere within a field value. Check this link for a better understanding of Substring Comparison.
publibz.boulder.ibm.com/cgi-bin/bookmgr_OS390/BOOKS/ice1ca50/3.7.4
| Quote: |
| Also, if in the sequence number i need to have numbering like N00000000001. (sequence is 12 bytes and the first letter is always N) |
That is quite simple. All you are doing is making the sequm a 11 byte field with N in front. If that is the case just change this statement in my original post
| Code: |
OVERLAY=(4901:SEQNUM,12,ZD),HIT=NEXT),
|
to
| Code: |
OVERLAY=(4901:C'N',SEQNUM,11,ZD),HIT=NEXT),
|
|
|
| Back to top |
|
 |
kitchu84
New User
Joined: 02 Dec 2006 Posts: 33 Location: chennai
|
|
|
|
Thanks again!!! You rock!  |
|
| Back to top |
|
 |
Escapa
Senior Member

Joined: 16 Feb 2007 Posts: 1399 Location: IL, USA
|
|
|
|
Hi Kolusu,
I am just thinking.. Why you have used..
| Code: |
IFTHEN=(WHEN=(1,1,SS,EQ,C'P,B'), |
Rather it could be just...
.. .and hence no need of hit=next also...  |
|
| Back to top |
|
 |
sqlcode1
Active Member
Joined: 08 Apr 2010 Posts: 577 Location: USA
|
|
|
|
What if there are other record types like X,Y,Z?
Thanks, |
|
| Back to top |
|
 |
Escapa
Senior Member

Joined: 16 Feb 2007 Posts: 1399 Location: IL, USA
|
|
|
|
| sqlcode1 wrote: |
What if there are other record types like X,Y,Z?
Thanks, |
OP says
| Quote: |
File1: LRECL=4900, RECFM=FB with record type as 'P'(position 1).
File2: LRECL=4900, RECFM=FB with record type as 'B' (position 1).
|
|
|
| Back to top |
|
 |
Skolusu
Senior Member
Joined: 07 Dec 2007 Posts: 2205 Location: San Jose
|
|
|
|
Escapa,
I assumed that there can be other record types other than 'P' and 'B'. If OP is sure of the record types then we can use When=init. The provided solutions takes care even when they have different record types. |
|
| Back to top |
|
 |
|
|
 |
All times are GMT + 6 Hours |
|