|
View previous topic :: View next topic
|
| Author |
Message |
Niki
Active User
Joined: 20 Sep 2008 Posts: 106 Location: Bangalore
|
|
|
|
Hello,
I have a VB file of LRECL 1000.
We have a PD field(PIC S9(17) COMP-3) which starts from position 100.
Now we have to mask the filed like below:
Input file: The value of the field in hex looks like below,
| Code: |
X'012354621598123546C'
X'215687741669841125C'
|
And output should look like ,
| Code: |
X'000000000000003546C'
X'000000000000001125C' |
Condition:
We need to mask 0 to all the values except the last four of the PD field.
The other fields should be as it is and in same VB format.
Could someone please help me on this.
Thanks in advance.
Code'd |
|
| Back to top |
|
 |
dbzTHEdinosauer
Global Moderator

Joined: 20 Oct 2006 Posts: 6965 Location: porcelain throne
|
|
|
|
X'012354621598123546C'
should be
X'12354621598123546C'
and
X'215687741669841125C'
should be
X'15687741669841125C'
if you want all except the last four significant digits overlayed then
X'12354621598123546C' would become
X'00000000000003546C'
and
X'15687741669841125C' would become
X'00000000000001125C'
is that what you want?
then you will have to expand the pd to zd, zero the zd
and then repack
because what you are trying to do is zero a half byte. |
|
| Back to top |
|
 |
Skolusu
Senior Member
Joined: 07 Dec 2007 Posts: 2205 Location: San Jose
|
|
|
|
Niki,
Use the following DFSORT JCL
| Code: |
//STEP0100 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SORTIN DD DSN=Your Input VB file,DISP=SHR
//SORTOUT DD SYSOUT=*
//SYSIN DD *
OPTION COPY
INREC OVERLAY=(104:6Z,110,3,PD,MOD,+10000,PD,LENGTH=3)
//* |
|
|
| Back to top |
|
 |
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
Earlier this week we saw TRAN=BIT and TRAN=UNBIT used. With these it would be possible to clobber the high-oder four bits of byte 7 of the field.
Another possibility: PD0 (see Appendix C in the manual) is a 2-8 byte field definition which ignores the "sign" in a packed-decimal (it appears as '0') and ignores the left-most digit. The result is always an even number of digits with no sign. You need four digits, and TO=PD,LENGTH=9 (in your case) should get it back to a positive 9-byte packed field, but with only four non-zero digits. If your field can be -ve, you'd need an extra bit of code for that.
| Code: |
//STEP0100 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SORTOUT DD SYSOUT=*
//SYSIN DD *
OPTION COPY
INREC IFTHEN=(WHEN=INIT,
OVERLAY=(10:1,8,ZD,
TO=PD,
LENGTH=5)),
IFTHEN=(WHEN=INIT,
OVERLAY=(20:12,3,PD0,
TO=PD,
LENGTH=5))
//SORTIN DD *
99991234
99991235
99991236
99991237
99991238
99994569
99994560
99999999 |
Output is:
| Code: |
99991234 rj < <
FFFFFFFF4099244444400024
9999123409913C000000013C
-----------------------
99991235 rj * *
FFFFFFFF4099254444400025
9999123509913C000000013C
-----------------------
99991236 rj % %
FFFFFFFF4099264444400026
9999123609913C000000013C
-----------------------
99991237 rj @ @
FFFFFFFF4099274444400027
9999123709913C000000013C
-----------------------
99991238 rj
FFFFFFFF4099284444400028
9999123809913C000000013C
-----------------------
99994569 rm
FFFFFFFF4099594444400059
9999456909946C000000046C
-----------------------
99994560 rm
FFFFFFFF4099504444400050
9999456009946C000000046C
-----------------------
99999999 rrr r
FFFFFFFF4099994444400099
9999999909999C000000099C |
|
|
| Back to top |
|
 |
|
|
 |
All times are GMT + 6 Hours |
|