View previous topic :: View next topic
|
Author |
Message |
pecram24
New User
Joined: 12 Oct 2009 Posts: 35 Location: Chennai
|
|
|
|
Hi,
This is my requirement,
My input file is having character fileds with Length 7 including the sign ( Number is written as Char ).
000500
000789-
and my output should be,
500
789-
with length 11.
Can anyone please help me on this... sorry if this is already discussed in our forum. |
|
Back to top |
|
|
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
You're not really going to a ZD are you?
If you can find a zero-suppressing edit mask, give it a length of 11 and then JFY LEFT the field, that should do it. Your data type is Signed Free Form (SFF) if you want to use the CHAR as a number. You'll end up with another SFF, but that is what you want. |
|
Back to top |
|
|
pecram24
New User
Joined: 12 Oct 2009 Posts: 35 Location: Chennai
|
|
|
|
hi Bill,
my input file is having the amt as
0010790
0020152
0021656
-0000488
and i need it to be,
00000010790
00000020152
00000021656
-00000000488
how i can achive this.. |
|
Back to top |
|
|
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
Please when posting data put it in the Code tags, which preserve spacing. Use the Preview button and adjust until you are happy it represents your data accurately.
Now, is this another requirement or is it the first one restated as it actually is?
What is the length of your input field? Is it fixed, or variable? If variable, is the only variance the presence or absence of the "-"?
If you already have the leading zeros and you just want more, I'd be inclined to use a BUILD to just add the extra zeros. Exactly what that would be depends on your answers. |
|
Back to top |
|
|
pecram24
New User
Joined: 12 Oct 2009 Posts: 35 Location: Chennai
|
|
|
|
hi Bill,
sorry for not posting the required details...
The file is Fixed length..and the filed contins the zeros as given in the input file.i need to have few more zeros as u said.. can u give the syntax.. for it |
|
Back to top |
|
|
Frank Yaeger
DFSORT Developer
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
You can use a DFSORT job like the following to do what you asked for:
Code: |
//S1 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SORTIN DD *
0010790
0020152
0021656
-0000488
//SORTOUT DD SYSOUT=*
//SYSIN DD *
OPTION COPY
INREC BUILD=(1,8,SFF,EDIT=(STTTTTTTTTTT),SIGNS=(,-))
|
SORTOUT would have:
Code: |
00000010790
00000020152
00000021656
-00000000488
|
|
|
Back to top |
|
|
pecram24
New User
Joined: 12 Oct 2009 Posts: 35 Location: Chennai
|
|
|
|
Hi Bill thanks for your post..
could you please answer for the below,
i got the required o/p ...
the out file contains,
Code: |
-00000000330
-00000000500
-00000000500
-00000000500
00000000500
00000000500
00000000500
00000000000
|
i am trying to add the above amt using a sort card...
can i use the data format as SFF with ZD it is not considering the sign.. it just adds the amount.. i verified it in the o/p file. can u please help me on this........
Thanks in advance !!!! |
|
Back to top |
|
|
Skolusu
Senior Member
Joined: 07 Dec 2007 Posts: 2205 Location: San Jose
|
|
|
|
pecram24 wrote: |
could you please answer for the below,
i got the required o/p ...
i am trying to add the above amt using a sort card...
can i use the data format as SFF with ZD it is not considering the sign.. it just adds the amount.. i verified it in the o/p file. can u please help me on this........ |
Why don't you post the complete requirement? We would provide you with a single solution without any conversion or intermediate output.
Please provide the following details.
1. What is the requirement - what exactly should the output look like for your input example?
2. What is the LRECL and RECFM of the input and output files?
3. What is the position and format of the field to be summed? |
|
Back to top |
|
|
|