View previous topic :: View next topic |
Author |
Message |
shuko Beginner
Joined: 08 Nov 2005 Posts: 73 Topics: 20
|
Posted: Wed Jan 23, 2008 8:34 am Post subject: Add some values to existing records in a specific column |
|
|
I am trying to append some random numbers 5 bytes to a an existing record values which starts in postion 34 till 66 (maximum 32 bytes). This column has variable length values. This is to be done only if records in position 1 till 5 has the value 2ADDV.
Example
Code: |
position 1-5 position 34-66
2ADDV 146-TW27072845
2ADDV 145-TW22702 |
The expected output
Code: |
position 1-5 position 34-66
2ADDV 146-TW2707284512345
2ADDV 145-TW2270256789 |
Random numbers 12345 and 56789 has been added to the existing values. What is the best way to achieve this.
Thank You |
|
Back to top |
|
|
vkphani Intermediate
Joined: 05 Sep 2003 Posts: 483 Topics: 48
|
Posted: Wed Jan 23, 2008 8:48 am Post subject: |
|
|
shuko,
How and from where do you get the random values 12345, 56789? |
|
Back to top |
|
|
shuko Beginner
Joined: 08 Nov 2005 Posts: 73 Topics: 20
|
Posted: Wed Jan 23, 2008 1:02 pm Post subject: |
|
|
The random numbers should be preferably generated or it could also
be a 5 byte number which gets incremented.
Shuko |
|
Back to top |
|
|
Frank Yaeger Sort Forum Moderator
Joined: 02 Dec 2002 Posts: 1618 Topics: 31 Location: San Jose
|
Posted: Wed Jan 23, 2008 1:31 pm Post subject: |
|
|
I can't give you random numbers, but you can get what you want with sequence numbers using a DFSORT job like this:
Code: |
//S1 EXEC PGM=ICEMAN
//SYSOUT DD SYSOUT=*
//SORTIN DD *
2ADDV 146-TW27072845
2ADDV 145-TW22702
1ADDV 145-TW22702
2ADDV 145-TW22702AAAAAAAAAAAAAAAAAAAAAA
/*
//SORTOUT DD SYSOUT=*
//SYSIN DD *
OPTION COPY
INREC IFOUTLEN=80,
IFTHEN=(WHEN=(1,5,CH,EQ,C'2ADDV'),
OVERLAY=(67:SEQNUM,5,ZD),HIT=NEXT),
IFTHEN=(WHEN=(1,5,CH,EQ,C'2ADDV'),
OVERLAY=(34:34,38,SQZ=(SHIFT=LEFT)))
/*
|
SORTOUT would have:
Code: |
2ADDV 146-TW2707284500001
2ADDV 145-TW2270200002
1ADDV 145-TW22702
2ADDV 145-TW22702AAAAAAAAAAAAAAAAAAAAAA00003
|
_________________ Frank Yaeger - DFSORT Development Team (IBM)
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
DFSORT is on the Web at:
www.ibm.com/storage/dfsort |
|
Back to top |
|
|
Terry_Heinze Supermod
Joined: 31 May 2004 Posts: 391 Topics: 4 Location: Richfield, MN, USA
|
Posted: Wed Jan 23, 2008 4:23 pm Post subject: |
|
|
Another method would be to use the intrinsic FUNCTION RANDOM, then place your random number in the appropriate location using INSPECT or FUNCTION or manually determining where the 5-digit number should be placed. _________________ ....Terry |
|
Back to top |
|
|
shuko Beginner
Joined: 08 Nov 2005 Posts: 73 Topics: 20
|
Posted: Thu Jan 24, 2008 1:51 am Post subject: |
|
|
Thank you very much Frank,works as expected.
Shuko |
|
Back to top |
|
|
ranga_subham Intermediate
Joined: 31 Jan 2006 Posts: 255 Topics: 72
|
Posted: Tue Jan 29, 2008 6:28 am Post subject: |
|
|
Would somebody suggest a SYNCSORT version of this please?
TIA. _________________ Ranga
*****
None of us is as smart as all of us - Ken Blanchard |
|
Back to top |
|
|
vkphani Intermediate
Joined: 05 Sep 2003 Posts: 483 Topics: 48
|
Posted: Tue Jan 29, 2008 7:34 am Post subject: |
|
|
ranga_subham wrote: | Would somebody suggest a SYNCSORT version of this please?
TIA. |
Version of which SYNCSORT? |
|
Back to top |
|
|
ranga_subham Intermediate
Joined: 31 Jan 2006 Posts: 255 Topics: 72
|
Posted: Tue Jan 29, 2008 7:54 am Post subject: |
|
|
SYNCSORT FOR Z/OS 1.2.2.1R _________________ Ranga
*****
None of us is as smart as all of us - Ken Blanchard |
|
Back to top |
|
|
|
|