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
 

 

How to unpack the packed decimal data using easytrieve

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> CA Products
View previous topic :: :: View next topic  
Author Message
hnharish

New User


Joined: 30 Aug 2005
Posts: 22

PostPosted: Tue Nov 11, 2008 4:56 pm    Post subject: How to unpack the packed decimal data using easytrieve
Reply with quote

I have packed decimal data in the input file and i have to unpack the data and write into output file.Ex: If i have a 100.00 dollars amount stored in the packed decimal field after the data is moved into the output field it has to display 100.00 in the readable format.So how to declare the output field.

Ex:
Input File:
FILE FILEIN1 FB(730 27740)
FILEIN1-TOTPYMT 64 8 P

Output File:
FILE FILEIN2 FB(73 0)
FILEIN2-TOTPYMT ?
Back to top
View user's profile Send private message

anandinmainframe

Active User


Joined: 31 May 2007
Posts: 171
Location: India

PostPosted: Tue Nov 11, 2008 5:02 pm    Post subject: Reply to: How to unpack the packed decimal data using easytr
Reply with quote

Hi,
you can declare the working storage as FILEIN2-TOTPYMT 10 N
Back to top
View user's profile Send private message
hnharish

New User


Joined: 30 Aug 2005
Posts: 22

PostPosted: Tue Nov 11, 2008 5:21 pm    Post subject: Re: Reply to: How to unpack the packed decimal data using ea
Reply with quote

anandinmainframe wrote:
Hi,
you can declare the working storage as FILEIN2-TOTPYMT 10 N


As mentioned earlier FILEIN1-TOTPYMT 64 8 P corresponds to S9(13)V99 COMP-3 in cobol.So i have to declare FILEIN2-TOTPYMT as FILEIN2-TOTPYMT 48 15 N. But this is not working becuase in the input file if COMP-3 data contains 82.55 in the output i m getting 000000000008255 the decimal dot is missing.
Back to top
View user's profile Send private message
hnharish

New User


Joined: 30 Aug 2005
Posts: 22

PostPosted: Tue Nov 11, 2008 5:42 pm    Post subject: Re: Reply to: How to unpack the packed decimal data using ea
Reply with quote

hnharish wrote:
anandinmainframe wrote:
Hi,
you can declare the working storage as FILEIN2-TOTPYMT 10 N


As mentioned earlier FILEIN1-TOTPYMT 64 8 P corresponds to S9(13)V99 COMP-3 in cobol.So i have to declare FILEIN2-TOTPYMT as FILEIN2-TOTPYMT 48 15 N. But this is not working becuase in the input file if COMP-3 data contains 82.55 in the output i m getting 000000000008255 the decimal dot is missing.


Also if i declare
FILEIN2-TOTPYMT 48 15 N MASK(A '9999999999999.99')
and display the data in the FILEIN2-TOTPYMT i m getting proper result i'e., 0000000000082.55.But in the output file i m getting 000000000008255 the decimal dot is missing.
Back to top
View user's profile Send private message
anandinmainframe

Active User


Joined: 31 May 2007
Posts: 171
Location: India

PostPosted: Tue Nov 11, 2008 6:20 pm    Post subject: Reply to: How to unpack the packed decimal data using easytr
Reply with quote

Hi,
Declare this as FILEIN2-TOTPYMT 48 15 N 2
Back to top
View user's profile Send private message
hnharish

New User


Joined: 30 Aug 2005
Posts: 22

PostPosted: Tue Nov 11, 2008 6:25 pm    Post subject: Re: Reply to: How to unpack the packed decimal data using ea
Reply with quote

anandinmainframe wrote:
Hi,
Declare this as FILEIN2-TOTPYMT 48 15 N 2


This is also giving the result 000000000825500 here also the dot is missing.I think we have to look for any alphanumeric data type like x in cobol.
Back to top
View user's profile Send private message
dick scherrer

Site Director


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

PostPosted: Wed Nov 12, 2008 4:25 am    Post subject:
Reply with quote

Hello,

To do what you want, use change your MASK.

Try 'ZZZZZZZZZZZ9.99' and adjust if you want punctuation with commas or if you want a minus sign.
Back to top
View user's profile Send private message
Arun Raj

Moderator


Joined: 17 Oct 2006
Posts: 2180
Location: @my desk

PostPosted: Wed Nov 12, 2008 11:21 am    Post subject:
Reply with quote

Hi Harish,

I believe easytrieve as such cannot generate signs/decimal points by itself while writing to a file and we need to provide them explicitly. I ran a small test and that worked fine for me. May be you can give it a try.

Code:
    FILE INFILEI1                                     
        IN-REC                1   80   A             
        IN-COST               1    8   P             
        FILLER-1              9   72   A             
                                                       
    FILE OUTFILE1                                     
        OUT-REC               1   80   A               
        OUT-COST              1   16   A               
                                                       
     WS-COST                       W  15   N           
        COSTA WS-COST                 13   N           
        COSTB WS-COST             +13  2   N           
     WS-COST-D                     W  16   A           
        COSTX     WS-COST-D           13   A           
        COSTD     WS-COST-D       +13  1   A  VALUE '.'
        COSTY     WS-COST-D       +14  2   A           
*                                                     
JOB INPUT(INFILEI1)                                   
WS-COST     =  IN-COST                                 
COSTX       =  COSTA                                   
COSTY       =  COSTB                                   
OUT-COST    =  WS-COST-D   
PUT OUTFILE1   

INFILEI1
Code:
IN-COST          FILLER
8/P              72/AN
(1-8)            (9-63)
1--------------- 2-----
***********************
1234567890123.45   

OUTFILE1
Code:
1234567890123.45
Back to top
View user's profile Send private message
anandinmainframe

Active User


Joined: 31 May 2007
Posts: 171
Location: India

PostPosted: Wed Nov 12, 2008 3:55 pm    Post subject: Reply to: How to unpack the packed decimal data using easytr
Reply with quote

Hi,
If FILEIN1-TOTPYMT 64 8 P 2 then if you give declare
FILEIN2-TOTPYMT 48 15 N 2 then it will do what you want.
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 -> CA Products All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Storing huge volume of data, compare ... Pradeep K M All Other Mainframe Topics 3 Mon Jan 16, 2017 5:08 pm
No new posts how to recover an uncataloged VSAM da... archanamuthukrishnan All Other Mainframe Topics 3 Wed Jan 11, 2017 6:18 pm
No new posts HALDB data refresh/copy from producti... vineetanand2007 IMS DB/DC 0 Mon Jan 02, 2017 11:16 am
No new posts JES2 JEC: Use UNIX Pipes to Pass Data... Virendra Shambharkar JCL & VSAM 21 Tue Dec 20, 2016 6:55 pm
No new posts Is the 'prompt' data for the DSLIST p... Willy Jensen TSO/ISPF 2 Tue Dec 06, 2016 4:38 am


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