Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

Change the field length while converting CHAR to ZD

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

New User


Joined: 12 Oct 2009
Posts: 35
Location: Chennai

PostPosted: Wed Apr 11, 2012 9:15 pm    Post subject: Change the field length while converting CHAR to ZD
Reply with quote

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

Bill Woodger

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7231

PostPosted: Wed Apr 11, 2012 9:56 pm    Post subject: Reply to: Change the field length while converting CHAR to Z
Reply with quote

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

New User


Joined: 12 Oct 2009
Posts: 35
Location: Chennai

PostPosted: Wed Apr 11, 2012 10:04 pm    Post subject:
Reply with quote

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

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7231

PostPosted: Wed Apr 11, 2012 10:12 pm    Post subject:
Reply with quote

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

New User


Joined: 12 Oct 2009
Posts: 35
Location: Chennai

PostPosted: Wed Apr 11, 2012 10:16 pm    Post subject:
Reply with quote

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

DFSORT Moderator


Joined: 15 Feb 2005
Posts: 7130
Location: San Jose, CA

PostPosted: Wed Apr 11, 2012 10:20 pm    Post subject:
Reply with quote

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

New User


Joined: 12 Oct 2009
Posts: 35
Location: Chennai

PostPosted: Wed Apr 11, 2012 11:13 pm    Post subject:
Reply with quote

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

Senior Member


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

PostPosted: Wed Apr 11, 2012 11:26 pm    Post subject: Reply to: Change the field length while converting CHAR to Z
Reply with quote

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
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 Performing arithmetic on input field zh_lad DFSORT/ICETOOL 15 Tue Dec 06, 2016 8:04 pm
No new posts Add PD field from 2nd file to PD in 1st Sushant Garje DFSORT/ICETOOL 6 Thu Dec 01, 2016 4:32 pm
No new posts SQZ pipe delimited file with 1 column... Rick Silvers DFSORT/ICETOOL 2 Sun Nov 06, 2016 8:11 pm
No new posts Joinkeys operation when key1 and key2... Susanta DFSORT/ICETOOL 5 Wed Nov 02, 2016 5:35 pm
No new posts How to split the records using the am... vnktrrd DFSORT/ICETOOL 24 Fri Oct 28, 2016 7:33 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us