View previous topic :: View next topic
|
Author |
Message |
somapradeep1
New User
Joined: 07 Sep 2010 Posts: 22 Location: hyderabad
|
|
|
|
Hi,
In my input file one of the field is zip pic s9(9) comp-3.it's data is 465280000
my requirement is i want to copy the all the fields in to another file along with the zip field with out zeroes.
ex
--------
Code: |
i/p o/p
----- -------
485690000 48569
568920000 56892
65320000 6532
|
please help me regarding this problem.. |
|
Back to top |
|
|
Robert Sample
Global Moderator
Joined: 06 Jun 2008 Posts: 8696 Location: Dubuque, Iowa, USA
|
|
|
|
What if the input value is 400390000? |
|
Back to top |
|
|
somapradeep1
New User
Joined: 07 Sep 2010 Posts: 22 Location: hyderabad
|
|
|
|
if the i/p is 400390000 the o/p should be
40039 it should take first five values only..... |
|
Back to top |
|
|
sqlcode1
Active Member
Joined: 08 Apr 2010 Posts: 577 Location: USA
|
|
|
|
somapradeep1,
Are you always going to have 4 trailing zeros? What is the exact field definition for the output field?
Thanks, |
|
Back to top |
|
|
somapradeep1
New User
Joined: 07 Sep 2010 Posts: 22 Location: hyderabad
|
|
|
|
yes,the o/p field is numeric... |
|
Back to top |
|
|
sqlcode1
Active Member
Joined: 08 Apr 2010 Posts: 577 Location: USA
|
|
|
|
Untested...
Code: |
//STEP0100 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SORTIN DD *
รค
//SORTOUT DD OUTPUT.FILE,
//SYSIN DD *
OPTION COPY
INREC OVERLAY=(1,5,PD,DIV,+10000,TO=PD,LENGTH=5)
/* |
Thanks, |
|
Back to top |
|
|
sqlcode1
Active Member
Joined: 08 Apr 2010 Posts: 577 Location: USA
|
|
|
|
Quote: |
Sqlcode,
Length=9 will increase the output field. Did you mean TO=ZD? |
No I meant to keep it as PD only. Length was a typo, it should be 5.
Thanks, |
|
Back to top |
|
|
Frank Yaeger
DFSORT Developer
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
somapradeep1,
Let's assume that your 5-byte PD field is in positions 11-15 and always ends with 4 zeros (e.g. X'485690000C') and you want to convert it to a 5-byte PD field in positions 11-15 without the 4 zeros (e.g. X'000048569C').
Here are two ways to do it with DFSORT:
Code: |
OPTION COPY
INREC OVERLAY=(11:11,3,PD,TO=PD,LENGTH=5)
|
or
Code: |
OPTION COPY
INREC OVERLAY=(11:11,5,PD,DIV,+10000,TO=PD,LENGTH=5)
|
If that's not what you want to do, then please explain more clearly what you want to do with examples of input and expected output in HEX. |
|
Back to top |
|
|
somapradeep1
New User
Joined: 07 Sep 2010 Posts: 22 Location: hyderabad
|
|
|
|
thank you ver much.... |
|
Back to top |
|
|
somapradeep1
New User
Joined: 07 Sep 2010 Posts: 22 Location: hyderabad
|
|
|
|
your sort card is working very fine but,if the field contains only one 0 its giving soc 7 can u help me in this situuation please sir... |
|
Back to top |
|
|
somapradeep1
New User
Joined: 07 Sep 2010 Posts: 22 Location: hyderabad
|
|
|
|
Hi,
In my input file one of the field is zip pic s9(9) comp-3.it's data is 465280000
my requirement is i want to copy the all the fields in to another file along with the zip field with out zeroes.
ex
--------
Code: |
i/p o/p
----- -------
485690000 48569
568920000 56892
65320000 6532
0 0
space 0
|
please help me regarding this problem.. |
|
Back to top |
|
|
enrico-sorichetti
Superior Member
Joined: 14 Mar 2007 Posts: 10873 Location: italy
|
|
|
|
looks like You did not care to understand ...
Quote: |
Let's assume that your 5-byte PD field is in positions 11-15 and always ends with 4 zeros (e.g. X'485690000C') |
it is more intelligent to post the complete requirement beforehand,
than complain afterward that the provide solution does not work ! |
|
Back to top |
|
|
Frank Yaeger
DFSORT Developer
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
somapradeep1,
If you can have spaces for your PD value, then you just need to add an IFTHEN clause to handle that as follows:
Method 1:
Code: |
OPTION COPY
INREC IFTHEN=(WHEN=(11,5,CH,NE,C' '),
OVERLAY=(11:11,3,PD,TO=PD,LENGTH=5)),
IFTHEN=(WHEN=NONE,OVERLAY=(11:+0,TO=PD,LENGTH=5))
|
Method 2:
Code: |
OPTION COPY
INREC IFTHEN=(WHEN=(11,5,CH,NE,C' '),
OVERLAY=(11:11,5,PD,DIV,+10000,TO=PD,LENGTH=5)),
IFTHEN=(WHEN=NONE,OVERLAY=(11:+0,TO=PD,LENGTH=5))
|
Please do try to give the complete requirement in your first post from now on. |
|
Back to top |
|
|
|