View previous topic :: View next topic
|
Author |
Message |
Atul Banke
New User
Joined: 08 Aug 2011 Posts: 7 Location: India
|
|
|
|
Hi,
I have a requirement to copy value from field1 (defined as 9(7) COMP3) to another field2 (defined as X(12)) in the same record. Additionally, the target field i.e. field2 should be left justified.
I have written a DFSORT to copy the value from field1 to field2 by converting it from PD to FS and SQZ operation to left justify is giving syntax error.
OUTFIL FNAMES=OUTDATA1
IFTHEN=(WHEN=(16,6,CH,EQ,C'111111'),
OVERLAY=(1634:3672,4,PD,TO=FS,SQZ=(SHIFT=LEFT,LENGTH=12))),
IFTHEN=(WHEN=NONE,
BUILD=(1,3800))
The input record is fixed byte 3800.
Field1 is at Pos 1634, length 12
Field2 is at Pos 3672, length 4
For example if the value in the field2 is 290 (FS value after conversion) then it should be populated in field1 as 290bbbbbbbbb where b is spaces.
Can you please assist me how I can achieve this in single ICETOOL step?
Thanks,
Atul |
|
Back to top |
|
|
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
Don't use FS use an EDIT with a zero-suppression mask. |
|
Back to top |
|
|
magesh23586
Active User
Joined: 06 Jul 2009 Posts: 213 Location: Chennai
|
|
|
|
You missed one comma after FNAMES and as per Bill advise, use EDIT.
use the below code and let us know the output.
Code: |
OUTFIL FNAMES=OUTDATA1,
IFTHEN=(WHEN=(16,6,CH,EQ,C'111111'),
OVERLAY=(1634:3672,4,PD,EDIT=(IIIIIIIIIIIT),
1634:1634,12,SQZ=(SHIFT=LEFT))),
IFTHEN=(WHEN=NONE,BUILD=(1,3800))
|
|
|
Back to top |
|
|
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
There's no need for the BUILD. |
|
Back to top |
|
|
magesh23586
Active User
Joined: 06 Jul 2009 Posts: 213 Location: Chennai
|
|
|
|
Bill,
True, not required. |
|
Back to top |
|
|
Atul Banke
New User
Joined: 08 Aug 2011 Posts: 7 Location: India
|
|
|
|
Thanks a lot Bill, Magesh -
This solution worked perfectly fine.
I am using BUILD for the other records as the overlay is required for specific records and the other records needs to be copied as it is.
Thanks again!
Regards,
Atul |
|
Back to top |
|
|
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
No you are not using BUILD for that. You are using BUILD to copy each of the 3800 bytes on each record not satisfying the IFTHEN to itself so that each byte has its original value before the BUILD, but CPU is consumed.
You may want to ask your client if they want to actually pay for nothing discernible to happen, and you may want to review existing code to make sure the same thing is not done elsewhere. |
|
Back to top |
|
|
|