View previous topic :: View next topic
|
Author |
Message |
chinnielr
New User
Joined: 11 Jul 2005 Posts: 87
|
|
|
|
Hi All,
I have a requirement as below.
I/P file contains 100 records. I want to insert a value between 10 to 20 bytes in first record to all the remaining records (99) between 70 to 80. My file has Basically of 150 bytes. Basically whatever the value is there B/W 10-20 positions in first record to be inserted into all the records.
Please let me know how to this efficiently.
Thanks in advance,
Chinni. |
|
Back to top |
|
|
ratheesh_1983
New User
Joined: 11 Apr 2007 Posts: 19 Location: hyderabad
|
|
|
|
oh chinni i cud n't get more confused!!!
ratheesh |
|
Back to top |
|
|
Anuj Dhawan
Superior Member
Joined: 22 Apr 2006 Posts: 6248 Location: Mumbai, India
|
|
|
|
Hi,
Please show your input file & the expected output to get better responses. |
|
Back to top |
|
|
krisprems
Active Member
Joined: 27 Nov 2006 Posts: 649 Location: India
|
|
|
|
chinnielr
Do you want the first record also in the o/p? |
|
Back to top |
|
|
krisprems
Active Member
Joined: 27 Nov 2006 Posts: 649 Location: India
|
|
|
|
chinnielr
Assuming you also need the 1st line in your o/p, this is the solution:
Code: |
//S1 EXEC PGM=ICEMAN
//SYSOUT DD SYSOUT=*
//SORTIN DD *
/*
//SORTOUT DD DSN=&&S1,UNIT=SYSDA,SPACE=(TRK,(1,1)),DISP=(,PASS)
//SYSIN DD *
SORT FIELDS=COPY,STOPAFT=1
INREC BUILD=(C'DATA1,''',11,9,C'''',80:X)
/*
//S2 EXEC PGM=ICEMAN
//SYSOUT DD SYSOUT=*
//SYMNAMES DD DSN=&&S1,DISP=(OLD,PASS)
//SORTIN DD *
/*
//OUT DD SYSOUT=*
//SYSIN DD *
OPTION COPY
INREC BUILD=(1,150,151:SEQNUM,4,ZD)
OUTFIL FNAMES=OUT,IFTHEN=(WHEN=(151,4,ZD,NE,+0001),
BUILD=(1,70,DATA1,80,70))
/*
|
|
|
Back to top |
|
|
Frank Yaeger
DFSORT Developer
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
Chinni,
krisprems is on the right track, but I think he has the positions of the fields wrong. Here's a DFSORT job that will do what you asked for:
Code: |
//S1 EXEC PGM=ICEMAN
//SYSOUT DD SYSOUT=*
//SORTIN DD DSN=... input file (FB/150)
//SORTOUT DD DSN=&&S1,UNIT=SYSDA,SPACE=(TRK,(1,1)),DISP=(,PASS)
//SYSIN DD *
OPTION COPY,STOPAFT=1
INREC BUILD=(C'DATA1,''',10,11,C'''',80:X)
/*
//S2 EXEC PGM=ICEMAN
//SYSOUT DD SYSOUT=*
//SYMNAMES DD DSN=&&S1,DISP=(OLD,PASS)
//SORTIN DD DSN=... input file (FB/150)
//SORTOUT DD DSN=... output file (FB/150)
//SYSIN DD *
OPTION COPY
INREC IFOUTLEN=150,
IFTHEN=(WHEN=INIT,OVERLAY=(151:SEQNUM,8,ZD)),
IFTHEN=(WHEN=(151,8,ZD,NE,+1),
OVERLAY=(70:DATA1))
/*
|
In the input file has:
Code: |
RECORD 1 12345678901
RECORD 2 AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
RECORD 3 BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB
|
The output file will have:
Code: |
RECORD 1 12345678901
RECORD 2 AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA12345678901
RECORD 3 BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB12345678901
|
If that's not what you want, then please explain what you do want with an example. |
|
Back to top |
|
|
krisprems
Active Member
Joined: 27 Nov 2006 Posts: 649 Location: India
|
|
|
|
Frank
I was very much keen about the positions, Chinnielr stated that the data is to be considered between 10 and 20th position and not from 10th to 20th position, So i considered from 11th position to 9 characters.
Please correct me if i am wrong |
|
Back to top |
|
|
Frank Yaeger
DFSORT Developer
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
Quote: |
I was very much keen about the positons |
Not sure what "keen" means in this context.
Chinni said "between 10 and 20" and between "70 and 80". I interpreted that to mean 11 bytes in each case since it wouldn't make any sense otherwise. Obviously, what he said was rather ambiguous. I guess only Chinni knows for sure what's needed. I do wish people would state things clears so we don't have to guess. |
|
Back to top |
|
|
krisprems
Active Member
Joined: 27 Nov 2006 Posts: 649 Location: India
|
|
|
|
"keen" : meant to say "concentrated"
Quote: |
Obviously, what he said was rather ambiguous
|
Thats true |
|
Back to top |
|
|
Frank Yaeger
DFSORT Developer
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
Quote: |
"keen" : meant to say "concentrated" |
Oh, I understand. I'd say "focused on" or "concentrating on" rather than "keen about". |
|
Back to top |
|
|
chinnielr
New User
Joined: 11 Jul 2005 Posts: 87
|
|
|
|
Hi Frank,
Thanks for your prompt reply. Sorry for any confusion caused.
The positions between 10-20 in the first record is 0104000100. I want to replace all the contents between the positions 70-80 for all remaining records (from 2nd record onwards to the last record) with the value from first record ie., 0104000100. Hope I am clear. By the way can anyone please let me know the a way to do it using SYNCSORT???
Thanks in advance!!
chinni. |
|
Back to top |
|
|
Frank Yaeger
DFSORT Developer
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
I'm a DFSORT developer. DFSORT and Syncsort are competitive products. I'm happy to answer questions on DFSORT and DFSORT's ICETOOL, but I don't answer questions on Syncsort. |
|
Back to top |
|
|
chinnielr
New User
Joined: 11 Jul 2005 Posts: 87
|
|
|
|
Hi Frank,
Could you please tell me in detail of the Syntax below
INREC BUILD=(C'DATA1,''',11,9,C'''',80:X)
Thanks and regards,
Kiran. |
|
Back to top |
|
|
chinnielr
New User
Joined: 11 Jul 2005 Posts: 87
|
|
|
|
Hi frank,
DATA1 contains any value and we are refering that value in Step S2?
What does SYMNAMES refers to?
thanks and regards,
Kiran. |
|
Back to top |
|
|
chinnielr
New User
Joined: 11 Jul 2005 Posts: 87
|
|
|
|
Is there a way to do this in a single step? |
|
Back to top |
|
|
murmohk1
Senior Member
Joined: 29 Jun 2006 Posts: 1436 Location: Bangalore,India
|
|
|
|
chinnielr,
Quote: |
Is there a way to do this in a single step? |
Use ICETOOL. |
|
Back to top |
|
|
krisprems
Active Member
Joined: 27 Nov 2006 Posts: 649 Location: India
|
|
|
|
murmohk1
Though you use ICETOOL, if you are using (COPY/SELECT/SPLICE...) more than one statement, then its considered as multistep SORT only! |
|
Back to top |
|
|
|