View previous topic :: View next topic
|
Author |
Message |
AneeshMani
New User
Joined: 25 Jan 2008 Posts: 24 Location: india
|
|
|
|
Hi
I have a problem with INREC overlay in Syncsort.
My input fields is 9(17) comp-3.
I/p
X'0000ABC1234567890'
X'0000BCC2345678901'
X'0000AAB3456789012'
X'0000BCC4567890123'
O/p
X'0000AAA2345678901'
X'0000AAA4567890123'
X'0000AAB3456789012'
X'0000ABC1234567890'
I need all the BCC changed to AAA and the file needs to be in sorted order after the changes.
I tried
Code: |
INREC IFTHEN=(WHEN=(3,2,CH,EQ,C'BCC' ),OVERLAY=(3:C'AAA')) |
My problems is i want to replace 1 and half bytes of hex data with some other. I believe this can be done using considering the data as PD.
I tried a few options, didn't work as expected.
Can anyone help me with this?
Thanks,
A
Known is a drop, Unknown is an ocean |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Hello,
The values shown are not packed-decimal. . .
Syncsort questions are posted in the JCL part of the forum, not the DFSORT part of the forum. Topic is being moved. |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Follow on:
Which release of Syncsort is being used? |
|
Back to top |
|
|
AneeshMani
New User
Joined: 25 Jan 2008 Posts: 24 Location: india
|
|
|
|
Hi dick,
Why do u say the data is not packed decimal. This is what i see when i do a HEX ON on the input file.
I am new to the shop ( few days.. ) not sure on the version... |
|
Back to top |
|
|
AneeshMani
New User
Joined: 25 Jan 2008 Posts: 24 Location: india
|
|
|
|
Hi dick,
The data is Packed decimal. am sure on that one.
This is wat i have used in my prog for the same file.
Code: |
01 FIELD-1 PIC 9(17) COMP-3.
01 FIELD-2 REDEFINES FIELD-1.
05 FILLER PIC 9(4)
05 SUB-FIELD-1 PIC 9(3)
05 SUB-FILED-2 PIC 9(10)
|
Thanks,
A |
|
Back to top |
|
|
AneeshMani
New User
Joined: 25 Jan 2008 Posts: 24 Location: india
|
|
|
|
Hi dick,
Ignore my prev posts. sorry for the trouble
Why do u say the input is not packed decimal.
This is my actual data.
I/p
X'00008781234567890'
X'00009992345678901'
X'00005673456789012'
X'00009994567890123'
O/p
X'00001112345678901'
X'00001114567890123'
X'00005673456789012'
X'00008781234567890'
This is the HEX form of the data.
I need the 999 replaced by 111 and sorted.
Can you please suggest a way for doing this?
Thanks,
A |
|
Back to top |
|
|
Arun Raj
Moderator
Joined: 17 Oct 2006 Posts: 2481 Location: @my desk
|
|
|
|
Quote: |
Why do u say the input is not packed decimal |
Because PD data has sign stored in the last half byte and 0-9 in all other positions and your data still does not seem to be valid PD. |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Thanks Arun,
Somehow this topic "got by me" over the weekend. . .
d |
|
Back to top |
|
|
AneeshMani
New User
Joined: 25 Jan 2008 Posts: 24 Location: india
|
|
|
|
I am sorry. Did not pay much attention to the signed part of the field.
The data will look like this.
X'00001231234567890C'
X'00004562234567891C'
My SYSIN should look like this i beieve
INREC IFTHEN=(WHEN=INIT,
BUILD=(1,80,1,9,PD,EDIT=(TTTTTTTTTTTTTTTTT))),
IFTHEN=(WHEN=(85,3,CH,EQ,C'BCC'),
OVERLAY=(85:C'AAA'))
SORT FIELDS=(85,3,CH,A)
OUTREC FIELDS=(1,80)
I was told I cannot overlay within a PD field.
My apologies dick .. wont happen again.
Thanks,
A |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Hello,
Quote: |
My apologies dick .. wont happen again. |
Not to worry - if this was the worst "thing" to happen this year, it would be a very good year
Sometimes it takes a couple of iterations to get on the same page, but this is understandable
d |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Hello,
You might consider using a sort-exit to invoke a bit of cobol code to reformat the value before sorting the data.
I'd move the packed-decimal field to a zoned-decimal field, make the change and move the modified zoned-decimal field back to the packed-decimal field. |
|
Back to top |
|
|
Arun Raj
Moderator
Joined: 17 Oct 2006 Posts: 2481 Location: @my desk
|
|
|
|
Hi Dick,
I was away for a while.
Is he trying to overlay numeric values? I got confused by the 'BCC' 'AAA' part. |
|
Back to top |
|
|
Arun Raj
Moderator
Joined: 17 Oct 2006 Posts: 2481 Location: @my desk
|
|
|
|
Quote: |
I was told I cannot overlay within a PD field |
AneeshMani,
You can replace your entire PD field like this to achieve what you want.
Code: |
//SYSIN DD *
INREC IFTHEN=(WHEN=INIT,OVERLAY=(81:1,9,PD,M11,LENGTH=17)),
IFTHEN=(WHEN=(85,3,ZD,EQ,999),
OVERLAY=(85:C'111',1:81,17,ZD,TO=PDC))
SORT FIELDS=(85,3,CH,A)
OUTREC BUILD=(1,80)
/* |
|
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Hi Arun,
We miss ya when you're away
If i understand correctly, the goal is to replace 3 of the packed digits in the field. . .
I believe this could be done if 2 bytes of binary were compared (i.e. 9990, 9991, 9992 - 9999 and replaced with 1110, 1111, 1112 - 1119) but this seems a bit cluttered (at least to me).
I've not looked for a way to compare 1.5 bytes
Using the exit, the zoned-decimal work field could be redefined and the 3 digits compared. I also don't know what esle might be part of this process that has not been posted.
d |
|
Back to top |
|
|
Arun Raj
Moderator
Joined: 17 Oct 2006 Posts: 2481 Location: @my desk
|
|
|
|
Quote: |
We miss ya when you're away |
Me too....
Quote: |
If i understand correctly, the goal is to replace 3 of the packed digits in the field |
I also thought the same and the above sort would do it, just a conversion from PD to display, replace the required numbers, sort and convert back. |
|
Back to top |
|
|
AneeshMani
New User
Joined: 25 Jan 2008 Posts: 24 Location: india
|
|
|
|
Hi Arun/D,
Thanks for your help. Here is the CARD that i used to work things out.
Code: |
INREC IFTHEN=(WHEN=INIT,
BUILD=(1,80,1,9,PD,EDIT=(TTTTTTTTTTTTTTTTT))),
IFTHEN=(WHEN=(85,3,CH,EQ,C'999'),
OVERLAY=(85:C'111'))
SORT FIELDS=(85,3,CH,A)
OUTREC FIELDS=(1:85,17,ZD,PD,LENGTH=9,2:10,71)
|
I am expanding the PD to ZD, change data sort and move back. Exactly as you said Arun.
Thanks for your SORT card as well. I will try that as well.
Thanks & Regards,
A |
|
Back to top |
|
|
|