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

How can you convert PD to (ZD? or CH?)


IBM Mainframe Forums -> DFSORT/ICETOOL
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
Mumblez

New User


Joined: 27 Apr 2007
Posts: 7
Location: Philippines

PostPosted: Thu May 03, 2007 8:59 am
Reply with quote

Hi,

How can you convert 398388.53 as PD to 00000003983885C (ZD? or CH?) format?

Code:

//SYSIN    DD *                                             
    OPTION COPY                                             
    INCLUDE COND=(1,2,CH,EQ,C'64')                         
    OUTFIL NODETAIL,REMOVECC,                               
      TRAILER1=(5:MIN=(5,5,UFF,M11,LENGTH=5),                       
                20:COUNT=(M11,LENGTH=9),                   
----->        29:TOT=(54,5,PD,TO=ZD,LENGTH=15),           


398388.53 is the result of TOT which will have an output of '000000039838853' but I need to have it formatted to '00000003983885C'

Thanks in advance for your help! icon_biggrin.gif
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: Thu May 03, 2007 9:17 pm
Reply with quote

You can just use DFSORT's ZDC format instead of ZD:

Code:

   29:TOT=(54,5,PD,TO=ZDC,LENGTH=15),


ZDC gives a C sign for positive values where ZD or ZDF gives an F sign for positive values.
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Thu May 03, 2007 9:30 pm
Reply with quote

Hello,

I may be confused here, but how can a "real" decimal point be in a packed-decimal field
Quote:
How can you convert 398388.53 as PD
icon_confused.gif

If there is a '.' in the data, PD is not the correct type icon_question.gif
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: Thu May 03, 2007 10:02 pm
Reply with quote

Dick,

I assumed the decimal point is implicit (it's not stored internally but is known to be there) as it always is in a PD value. I think many people who work with COBOL (or other languages) aren't aware of how the data is actually stored internally - they just look at the COBOL external definition which includes the decimal point.
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Fri May 04, 2007 2:15 am
Reply with quote

Hi Frank,

Yup, unfortunately
Quote:
I think many people who work with COBOL (or other languages) aren't aware of how the data is actually stored internally
this is all too true.

[sigh]Not understanding how their data is physically stored causes many of the newer folks much consternation and confusion. It also explains why trying to resolve something like an 0c7 is a more involved task than it would be if there was understanding of how data was stored.[/sigh]
Back to top
View user's profile Send private message
Mumblez

New User


Joined: 27 Apr 2007
Posts: 7
Location: Philippines

PostPosted: Fri May 04, 2007 1:04 pm
Reply with quote

Hi,

The '398388.53' stored as comp-3 is its value when the file is browsed through famvs with a display format of '000000039838853' (PD), that's what it meant.

Anyway, thank you guys very much, it worked!!!
Frank, you're awesome!!! icon_biggrin.gif icon_biggrin.gif icon_biggrin.gif
Back to top
View user's profile Send private message
Mumblez

New User


Joined: 27 Apr 2007
Posts: 7
Location: Philippines

PostPosted: Fri May 04, 2007 2:11 pm
Reply with quote

Hi,

follow up question.

how do i populate the rest of the trailer to high values?
right now, I am using multiple lines of X'FFFFFFFFFFFF...'
so my trailer would have an output fillers of dots as required.
is there any easier way?
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Fri May 04, 2007 7:26 pm
Reply with quote

Hello D-D,

I'm surprised that this display
Quote:
famvs with a display format of '000000039838853' (PD)

doesn't include the sign icon_confused.gif

What would be displayed via famvs if the PD number was negative?
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: Fri May 04, 2007 8:54 pm
Reply with quote

Quote:
how do i populate the rest of the trailer to high values?
right now, I am using multiple lines of X'FFFFFFFFFFFF...'
so my trailer would have an output fillers of dots as required.
is there any easier way?


Yes, you can use nX'FF' where n is the number of X'FF' characters you need. n can be 1 to 4095 and you can use multiple nX'FF' characters if you need more than 4095 of them (e.g. 4095X'FF',4000X'FF').
Back to top
View user's profile Send private message
Mumblez

New User


Joined: 27 Apr 2007
Posts: 7
Location: Philippines

PostPosted: Mon May 07, 2007 11:28 am
Reply with quote

Thanks a lot. icon_biggrin.gif
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 Need to convert date format DFSORT/ICETOOL 20
No new posts Keep leading zero(s) after convert fl... SYNCSORT 7
No new posts Convert single row multi cols to sing... DFSORT/ICETOOL 6
No new posts convert file from VB to FB and use tr... DFSORT/ICETOOL 8
No new posts Convert HEX to Numeric DB2 3
Search our Forums:

Back to Top