date in cobol datatype



Support for OS/VS COBOL, VS COBOL II, COBOL for OS/390 & VM and Enterprise COBOL for z/OS

date in cobol datatype

Postby pbc3199 » Wed Nov 10, 2010 7:42 am

Hi all,
what PIC should I use for date in HEX?
I want to store the date (20101108) in VSAM file like below

2110
0018

If i use PIC 9(8) comp-3, the result as below

00018
2110F

what PIC should I use to remove the F sign?
The reason I want to remove the F sign because the easytrieve program will retrieve the VSAM data create by the cobol.
Thanks
pbc3199
 
Posts: 6
Joined: Thu Jun 17, 2010 7:43 am
Has thanked: 0 time
Been thanked: 0 time

Re: date in cobol datatype

 

Re: date in cobol datatype

Postby dick scherrer » Wed Nov 10, 2010 9:02 am

Hello,

You cannot remove the sign. . . You could cause a C sign or a D sign. . . By definition, a packed-decimal (comp-3) value will have a sign. Without a sign, it is not packed-decimal.

You should probably start over with the question.
what PIC should I use for date in HEX?
Why should this even be done?

If you explain what you are trying to accomplish, we can probably offer better suggestions.

The reason I want to remove the F sign because the easytrieve program will retrieve the VSAM data create by the cobol.
This is a prime reason that packed-decimal not be used in a key.

How is this stored by the cobol program?
Hope this helps,
d.sch.
User avatar
dick scherrer
Global moderator
 
Posts: 6304
Joined: Sat Jun 09, 2007 8:58 am
Has thanked: 3 times
Been thanked: 91 times

Re: date in cobol datatype

Postby pbc3199 » Wed Nov 10, 2010 9:44 am

ok,

The problem is, I need to insert the data to VSAM file which the easytrieve program also use the VSAM file. So, the data should be as below as pack data.

0007210000000155000B00
761c00420101027c00b801


The layout is in easytrive as below:

 000001 MACRO                                                                   
 000002 *------------------------------------------------------------*         
 000003 * CASH ACCOUNT UPLOAD MTD FILE                               *         
 000004 *------------------------------------------------------------*         
 000005 RP141-TXN                                      1 1002 A                 
 000006    RP141-KEY                                   1   10 A                 
 000007       RP141-STATION-ID   RP141-KEY                  4 A                 
 000008          RP141-STSN-INST    RP141-STATION-ID        1 B 0               
 000009          RP141-STSN-BRANCH  RP141-STATION-ID  +1    3 P                 
 000010       RP141-TXN-DATE     RP141-KEY            +4    4 U                 
 000011       RP141-RECNUM       RP141-KEY            +8    2 B 0               
 000012    RP141-TOT-REC                              11    2 B 0               
 000013    RP141-ACC-REC                              13  990 A                 
 000014       RP141-ACC-DTL      RP141-ACC-REC             10 A   OCCURS (99)   
 000015          RP141-REV-CODE     RP141-ACC-DTL           4 B 0               
 000016          RP141-TXN-AMT      RP141-ACC-DTL           4 B 0               
 000017          RP141-TXN-CNT      RP141-ACC-DTL           2 B 0               
 000018 MEND                         


The first 4 bytes i merge the RP141-STSN-INST and RP141-STSN-BRANCH to convert to COBOL using PIC S9(7) USAGE COMP-3.
I'm successfull create the data as below

0007
761c

The problem is what datatype in COBOL should I use for the rest like RP141-TXN-DATE, RP141-RECNUM,.......
pbc3199
 
Posts: 6
Joined: Thu Jun 17, 2010 7:43 am
Has thanked: 0 time
Been thanked: 0 time

Re: date in cobol datatype

Postby dick scherrer » Wed Nov 10, 2010 10:20 am

Hello,

It may help if you post the corresponding cobol layout.
Hope this helps,
d.sch.
User avatar
dick scherrer
Global moderator
 
Posts: 6304
Joined: Sat Jun 09, 2007 8:58 am
Has thanked: 3 times
Been thanked: 91 times

Re: date in cobol datatype

Postby pbc3199 » Wed Nov 10, 2010 11:47 am

This is my cobol declaration
05 RP141-STSN-INST-BRANCH     PIC S9(07) USAGE COMP-3. 
05 RP141-TXN-DATE-REC-TOT     PIC 9(16) USAGE COMP.     
05 RP141-REV-CODE             PIC 9(07) USAGE COMP-3.   
05 RP141-TXN-AMT              PIC 9(07)V99 USAGE COMP-3.
05 RP141-TXN-CNT              PIC 9(04) USAGE COMP-3.   
pbc3199
 
Posts: 6
Joined: Thu Jun 17, 2010 7:43 am
Has thanked: 0 time
Been thanked: 0 time

Re: date in cobol datatype

Postby dick scherrer » Thu Nov 11, 2010 3:32 am

Hello,

Why do the layouts contain different "fields". . .?
Hope this helps,
d.sch.
User avatar
dick scherrer
Global moderator
 
Posts: 6304
Joined: Sat Jun 09, 2007 8:58 am
Has thanked: 3 times
Been thanked: 91 times

Re: date in cobol datatype

Postby pbc3199 » Thu Nov 11, 2010 7:59 am

Hello,

The Cobol program will write the VSAM file based on easytrieve layout (See MACRO file layout).
So, the problem that I face right now is to match the COBOL datatype and easytrieve data type.
From my last post in this forum, I attached the COBOL declaration datatype from my COBOL program.
When I run the COBOL program, the program write the VSAM file but not same as what the easytrieve declared especially
for RP141-txn-date-rec-tot.
Please Dick Sherrer.....help me..... :( :(
pbc3199
 
Posts: 6
Joined: Thu Jun 17, 2010 7:43 am
Has thanked: 0 time
Been thanked: 0 time

Re: date in cobol datatype

Postby dick scherrer » Thu Nov 11, 2010 9:48 am

Hello,

Until we understand exactly what is going on, it will be difficult to provide help. . .

The COBOL and the Easytrieve layouts should be the same. So, once again, why are they different?

Keep in mind that you know exactly what you have and what you are talking about. Unfortunately, we do not. . .

I have seen many, many processes that use the "same" file as input and/or output in both COBOL and Easytrieve code. Each time this has been done, the layouts are the same (i.e. the same field names with compatible attributes).

Talk with whoever supports Easytrieve on your system and ask them to create an Easytrieve layout from the COBOL layout using CBLCNVRT (a tool provided with Easytrieve).
Hope this helps,
d.sch.
User avatar
dick scherrer
Global moderator
 
Posts: 6304
Joined: Sat Jun 09, 2007 8:58 am
Has thanked: 3 times
Been thanked: 91 times


Return to IBM Cobol

 


  • Related topics
    Replies
    Views
    Last post