View previous topic :: View next topic
|
Author |
Message |
suzeet
New User
Joined: 16 May 2005 Posts: 54
|
|
|
|
I am trying to convert a Packed Decimal field into a Zoned Decimal field. The picture clause of the field is S9(15) COMP-3. I want extract only the first 9 bytesof the field using OUTREC. How do i go about it? |
|
Back to top |
|
|
Craq Giegerich
Senior Member
Joined: 19 May 2007 Posts: 1512 Location: Virginia, USA
|
|
|
|
suzeet wrote: |
I am trying to convert a Packed Decimal field into a Zoned Decimal field. The picture clause of the field is S9(15) COMP-3. I want extract only the first 9 bytesof the field using OUTREC. How do i go about it? |
S9(15) comp-3 is only 8 bytes so you will have a hard time extracting only the first 9 bytes. Do you mean that your want only the first 9 (leftmost) digits or the last 9 (rightmost digits)? if the field has a value of 000000123456789, do you want 000000123 or 123456789 and what about the sign? |
|
Back to top |
|
|
suzeet
New User
Joined: 16 May 2005 Posts: 54
|
|
|
|
I don't want the sign field. I want only first 9 digit (leftmost) |
|
Back to top |
|
|
shankar.v
Active User
Joined: 25 Jun 2007 Posts: 196 Location: Bangalore
|
|
|
|
Hi suzeet,
Let us assume your S9(15) COMP-3 field is in position 1 and length 8 in a file.
Please check with the following code for your requirement.
Code: |
// EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SORTIN DD DSN=INFILE,DISP=SHR
//SORTOUT DD DSN=OUTFILE,...
//SYSIN DD *
OPTION COPY
INREC BUILD=(1,8,PD,EDIT=(TTTTTTTTTTTTTTT))
OUTREC BUILD=(1,9)
/* |
Thanks,
Shankar |
|
Back to top |
|
|
Frank Yaeger
DFSORT Developer
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
Here's a couple of ways to do it with DFSORT using just an INREC statement:
Code: |
//S1 EXEC PGM=ICEMAN
//SYSOUT DD SYSOUT=*
//SORTIN DD DSN=... input file
//SORTOUT DD DSN=... output file
//SYSIN DD *
OPTION COPY
INREC BUILD=(1,8,PD,DIV,+1000000,M11,LENGTH=9)
/*
|
Code: |
//S2 EXEC PGM=ICEMAN
//SYSOUT DD SYSOUT=*
//SORTIN DD DSN=... input file
//SORTOUT DD DSN=... output file
//SYSIN DD *
OPTION COPY
INREC IFTHEN=(WHEN=INIT,BUILD=(1,8,PD,M11)),
IFTHEN=(WHEN=INIT, BUILD=(1,9))
/*
|
|
|
Back to top |
|
|
|