Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Profile Log in to check your private messages Log in
 
Mask first 12 positions of PD field with 0

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
View previous topic :: :: View next topic  
Author Message
Niki

Active User


Joined: 20 Sep 2008
Posts: 102
Location: Bangalore

PostPosted: Fri Oct 05, 2012 9:33 pm    Post subject: Mask first 12 positions of PD field with 0
Reply with quote

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
View user's profile Send private message

dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6968
Location: porcelain throne

PostPosted: Fri Oct 05, 2012 10:29 pm    Post subject:
Reply with quote

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
View user's profile Send private message
Skolusu

Senior Member


Joined: 07 Dec 2007
Posts: 2205
Location: San Jose

PostPosted: Fri Oct 05, 2012 10:39 pm    Post subject:
Reply with quote

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
View user's profile Send private message
Bill Woodger

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7315

PostPosted: Sat Oct 06, 2012 4:51 am    Post subject: Reply to: Mask first 12 byte of PD field with 0
Reply with quote

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
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts sort records based on length exceeds ... maxsubrat DFSORT/ICETOOL 7 Wed Oct 04, 2017 4:48 pm
No new posts Partial color change of a field in CI... waseem0424 CICS 5 Fri Sep 29, 2017 7:56 pm
No new posts Remove leading spaces from numeric field rexx77 SYNCSORT 6 Wed Sep 06, 2017 2:15 am
No new posts JES2 job size field matching Windows ... SRICOBSAS All Other Mainframe Topics 4 Tue Sep 05, 2017 5:49 pm
No new posts READ A PACKED "NEGATIVE" FI... jdesouza CA Products 3 Tue May 02, 2017 11:43 pm

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us