IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

Change the field length while converting CHAR to ZD


IBM Mainframe Forums -> DFSORT/ICETOOL
Post new topic   Reply to topic
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
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

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Wed Apr 11, 2012 9:56 pm
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
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

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Wed Apr 11, 2012 10:12 pm
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
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 Developer


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

PostPosted: Wed Apr 11, 2012 10:20 pm
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
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
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 View Bookmarks
All times are GMT + 6 Hours
Forum Index -> DFSORT/ICETOOL

 


Similar Topics
Topic Forum Replies
No new posts Binary File format getting change whi... All Other Mainframe Topics 7
No new posts Issues Converting From ZD to Signed N... DFSORT/ICETOOL 4
No new posts Store the data for fixed length COBOL Programming 1
No new posts How to split large record length file... DFSORT/ICETOOL 10
No new posts PARSE Syntax for not fix length word ... JCL & VSAM 7
Search our Forums:

Back to Top