View previous topic :: View next topic
|
Author |
Message |
knarayan
New User
Joined: 25 Nov 2008 Posts: 9 Location: providence, ri
|
|
|
|
Hi.. I tried digging into this one but could not find a way to do it.
I have a s9(8) comp field that needs to be converted to an x(16) field. I tried using the length function, but that ended up right justifying the values in the field. I want it to be left justified. Is this possible?
Thanks in advance
n |
|
Back to top |
|
|
Skolusu
Senior Member
Joined: 07 Dec 2007 Posts: 2205 Location: San Jose
|
|
|
|
knarayan,
The following control cards will give you the desired results.
Assumptions:
1. Your input is FB recfm and 80 bytes in length
2. Your integer s9(8) comp field starts in position 1 and has only positive values.
3. You want the 16 byte value in pos 20 with left justified.
Code: |
//SYSIN DD *
SORT FIELDS=COPY
INREC IFOUTLEN=80,IFTHEN=(WHEN=INIT,
OVERLAY=(81:1,4,BI,M10,LENGTH=16,20:81,16,JFY=(SHIFT=LEFT)))
/* |
|
|
Back to top |
|
|
knarayan
New User
Joined: 25 Nov 2008 Posts: 9 Location: providence, ri
|
|
|
|
Thanks Kolusu.. That is fantastic... Quick question though .. what would you change there if you only had a subset of fields required in the INREC. for e.g if i needed to select fields 1,35. then this field was in position 36,4 and then the last field that i needed was in say 60,20. Can you actually use the INREC FIELDS along with this OVERLAY?
Thanks!! |
|
Back to top |
|
|
Frank Yaeger
DFSORT Developer
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
OVERLAY can be used when you want to replace specific bytes with the same number of bytes without changing the rest of the record.
If you want to reformat the records the way you say, you would need to use BUILD rather than OVERLAY and specify all of the fields you want in the output record. To do what you described, you could use these DFSORT control statements:
Code: |
OPTION COPY
INREC IFTHEN=(WHEN=INIT,
OVERLAY=(81:1,4,BI,M10,LENGTH=16,81:81,16,JFY=(SHIFT=LEFT))),
IFTHEN=(WHEN=INIT,BUILD=(1,35,81,16,60,20))
|
|
|
Back to top |
|
|
knarayan
New User
Joined: 25 Nov 2008 Posts: 9 Location: providence, ri
|
|
|
|
Thanks Frank.. That was helpful |
|
Back to top |
|
|
knarayan
New User
Joined: 25 Nov 2008 Posts: 9 Location: providence, ri
|
|
|
|
I wasn't really aware that we could actually pass the data from the first IFTHEN into the second IFTHEN.. DFSORT continues to surprise me |
|
Back to top |
|
|
Frank Yaeger
DFSORT Developer
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
Yes, you can reprocess records with multiple IFTHEN clauses. Note that OVERLAY can be used to reprocess fields as well. We aim to please! |
|
Back to top |
|
|
knarayan
New User
Joined: 25 Nov 2008 Posts: 9 Location: providence, ri
|
|
|
|
Frank Yaeger wrote: |
Yes, you can reprocess records with multiple IFTHEN clauses. Note that OVERLAY can be used to reprocess fields as well. We aim to please! |
Hi Frank... quick question. If you need to sort on these overlay fields, how do you specify the sort? I am running into issues when I try to sort the new layout
Thanks |
|
Back to top |
|
|
Frank Yaeger
DFSORT Developer
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
Back to top |
|
|
knarayan
New User
Joined: 25 Nov 2008 Posts: 9 Location: providence, ri
|
|
|
|
Thanks Frank.. Just wanted to let you know that I am really having fun with the nested ifthen... |
|
Back to top |
|
|
Frank Yaeger
DFSORT Developer
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
Quote: |
Just wanted to let you know that I am really having fun with the nested ifthen |
|
|
Back to top |
|
|
|