|
View previous topic :: View next topic
|
| Author |
Message |
amitc23
New User
Joined: 05 Nov 2014 Posts: 98 Location: India
|
|
|
|
Hi Friends
I have a requirement to create a big sequential file of around 10000 records with one of the HEX field incrementing at position 57. I tried SORT to achieve this but I am not getting the desired results.
Could you please help ?
I am trying to change the field at 55th position to insert a number x'0000000102052f' with an increment of 1 whenever the first 3 bytes are not x'00000f'.
Please suggest.
| Code: |
//STEP001 EXEC PGM=SORT
//SORTIN DD DSN=DTD.TEST.DATASET1,DISP=SHR
//SORTOUT DD SYSOUT=*
//SYSPRINT DD SYSOUT=*
//SYSOUT DD SYSOUT=*
//SYSIN DD *
OPTION COPY -
INREC IFTHEN=(WHEN=(1,3,PD,NE,X'00000F')) -
OVERLAY=(57:SEQNUM,16,PD,START=X'00000001020052F',INCR=1)
/*
|
[/code] |
|
| Back to top |
|
 |
Joerg.Findeisen
Senior Member

Joined: 15 Aug 2015 Posts: 1442 Location: Bamberg, Germany
|
|
|
|
Sample (change offsets and lengths to your needs):
| Code: |
//INCR EXEC PGM=ICEMAN
//SORTIN DD *
ABC
DEF
/*
//SORTOUT DD SYSOUT=*
//SYSOUT DD SYSOUT=*
//SYSIN DD *
OPTION COPY
INREC IFTHEN=(WHEN=(1,3,BI,NE,X'00000F'),
OVERLAY=(50:SEQNUM,16,PD,START=1020052,
50:50,16,PD,TO=PDF))
* OUTFIL BUILD=(1:1,3,HEX,X,50,16,HEX)
END
/* |
Output:
| Code: |
****** **************************** Datenanfang ************************
000001 ABC
CCC44444444444444444444444444444444444444444444440000000000001202
1230000000000000000000000000000000000000000000000000000000000005F
------------------------------------------------------------------------
000002 DEF
CCC44444444444444444444444444444444444444444444440000000000001203
4560000000000000000000000000000000000000000000000000000000000005F
------------------------------------------------------------------------
****** **************************** Datenende ************************** |
|
|
| Back to top |
|
 |
Rohit Umarjikar
Global Moderator

Joined: 21 Sep 2010 Posts: 3109 Location: NYC,USA
|
|
|
|
| amitc23 wrote: |
I am trying to change the field at 55th position to insert a number x'0000000102052f' with an increment of 1 whenever the first 3 bytes are not x'00000f'.
Please suggest.
| Code: |
//STEP001 EXEC PGM=SORT
//SORTIN DD DSN=DTD.TEST.DATASET1,DISP=SHR
//SORTOUT DD SYSOUT=*
//SYSPRINT DD SYSOUT=*
//SYSOUT DD SYSOUT=*
//SYSIN DD *
OPTION COPY -
INREC IFTHEN=(WHEN=(1,3,PD,NE,X'00000F')) -
OVERLAY=(57:SEQNUM,16,PD,START=X'00000001020052F',INCR=1)
/*
|
[/code] |
I don't see 55 but 57. What is that value 0- unsigned? |
|
| Back to top |
|
 |
amitc23
New User
Joined: 05 Nov 2014 Posts: 98 Location: India
|
|
|
|
| Thanks Joerg and Rohit. Checked the post today only. I wrote a small one time cobol program to achieve this. However will try this again when I get some time. |
|
| Back to top |
|
 |
|
|
 |
All times are GMT + 6 Hours |
|