Portal | IBM Manuals | Downloads | Products | Refer | Info | Programs | JCLs | Forum Rules*| Site Map | Mainframe CD 
IBMMAINFRAMES.com - IBM Mainframe Support Forums Index
 
Register
 
IBMMAINFRAMES.com - IBM Mainframe Support Forums Index FAQ Search Memberlist Usergroups Profile Log in to check your private messages Log in
 
Data declarations to convert the COBOL program to PL/I

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> PL/I & ASSEMBLER
Author Message
Kotes

New User


Joined: 03 May 2005
Posts: 24

PostPosted: Fri Jul 03, 2009 5:01 pm    Post subject: Data declarations to convert the COBOL program to PL/I
Reply with quote

Hi,

I am cobol developer, for one tool design, I need to convert the COBOL program to PL/I. Here I am not able to handle the data from files as flexible in COBOL. Yes, that because of lack of experience in PL/I.

1. Here is the cobol structure for reading the file, how to define the same structure in PL/I.

Code:
01 INPUT-RECORD-FORMAT-EXT.                         
   05 INPUTRTY-EXT1    PIC X(1).                                 
   05 INPUTTME-EXT1    PIC S9(8) BINARY.                   
   05 INPUTDTE-EXT1    PIC S9(7) PACKED-DECIMAL.     
   05 INPUTWID-EXT1    PIC X(04).                               
   05 INPUTSTP-EXT1    PIC S9(4) BINARY.                     
   05 SEGMENT-TRIPLES-EXT1 BINARY.                   
      10 INPUTEON-EXT1 PIC S9(4).                         
   05 INPUTSYN-EXT1    PIC X(08).                           
   05 INPUTSYP-EXT1    PIC X(08).                           
   05 INPUTJBN-EXT1    PIC X(08).                           
   05 INPUTPGM-EXT1    PIC X(08).                           
   05 INPUTSTM-EXT1    PIC X(08).                           
   05 INPUTJNM-EXT1    PIC X(08).                           
   05 INPUTSTN-EXT1    PIC S9(4) BINARY.               
   05 INPUTSIT-EXT1    PIC S9(8) BINARY.               
   05 INPUTSTD-EXT1    PIC S9(7) PACKED-DECIMAL.
   05 INPUTTEP-EXT1    PIC S9(8) BINARY.               
   05 INPUTSCC-EXT1    PIC S9(4) BINARY.               
   05 PROCESSOR-SECTION.                                       
      10 INPUTCPT-EXT1    PIC S9(8) BINARY.             
      10 INPUTCPS-EXT1    PIC S9(8) BINARY.             
      10 INPUTICU-EXT1    PIC S9(8) BINARY.             
      10 INPUTISB-EXT1    PIC S9(8) BINARY.             
      10 INPUTIIP-EXT1    PIC S9(8) BINARY.             
      10 INPUTRCT-EXT1    PIC S9(8) BINARY.           
      10 INPUTHPT-EXT1    PIC S9(8) BINARY.             
   05 INPUTRGN-EXT1    PIC S9(8) BINARY.               
   05 INPUT-EXCP OCCURS 255 TIMES.                       
      10 INPUTDDN-EXT1    PIC X(08).                       
      10 INPUTBLK-EXT1    PIC S9(8) BINARY.             
      10 INPUTBSZ-EXT1    PIC S9(4) BINARY.


I defined in PL/I with corresponding datatypes, but while compiling/executing the length it differs, and I want to know how read records into the new structure also.


2. How to initialize the group variables in the middle of the program(not at defination time).

Please help me.

Thanks in Advance,
Kotes
Code:
Back to top
View user's profile Send private message
References
enrico-sorichetti

Global Moderator


Joined: 14 Mar 2007
Posts: 5391
Location: italy

PostPosted: Fri Jul 03, 2009 5:13 pm    Post subject: Reply to: Data declarations
Reply with quote

Quote:
Here I am not able to handle the data from files as flexible in COBOL.
Quote:

usually it is the other way around ...
Yes, that because of lack of experience in PL/I.

yes that is the reason icon_biggrin.gif

show which data types do not match and somebody will gladly help
Back to top
View user's profile Send private message
Kotes

New User


Joined: 03 May 2005
Posts: 24

PostPosted: Mon Jul 06, 2009 4:12 pm    Post subject: Reply to: Data declarations to convert the COBOL program to
Reply with quote

Hi,
Here is the PL/I structure I defined as
Code:
DCL   1 INPUT_RECORD_FORMAT_EXT,                                 
              2 INPUTRTY_EXT1 CHAR(1),                                 
              2 INPUTTME_EXT1 FIXED BIN(31),                           
              2 INPUTDTE_EXT1 FIXED DECIMAL(7),                         
              2 INPUTWID_EXT1 CHAR(4),                                 
              2 INPUTSTP_EXT1 FIXED BIN(15),                           
              2 SEGMENT_TRIPLES_EXT1,                                   
               3 INPUTEON_EXT1 FIXED BIN(15),                           
              2 INPUTSYN_EXT1 CHAR(8),                                 
              2 INPUTSYP_EXT1 CHAR(8),                                 
              2 INPUTJBN_EXT1 CHAR(8),                                 
              2 INPUTPGM_EXT1 CHAR(8),                                 
              2 INPUTSTM_EXT1 CHAR(8),                                 
              2 INPUTJNM_EXT1 CHAR(8),                                 
              2 INPUTSTN_EXT1 FIXED BIN(15),                           
              2 INPUTSIT_EXT1 FIXED BIN(31),                           
              2 INPUTSTD_EXT1 FIXED DECIMAL(7),                         
              2 INPUTTEP_EXT1 FIXED BIN(31),                           
              2 INPUTSCC_EXT1 FIXED BIN(15),                           
              2 PROCESSOR_SECTION,                                     
               3 INPUTCPT_EXT1 FIXED BIN(31),                           
               3 INPUTCPS_EXT1 FIXED BIN(31),                           
               3 INPUTICU_EXT1 FIXED BIN(31),                           
               3 INPUTISB_EXT1 FIXED BIN(31),                           
               3 INPUTIIP_EXT1 FIXED BIN(31),                           
               3 INPUTRCT_EXT1 FIXED BIN(31),                           
               3 INPUTHPT_EXT1 FIXED BIN(31),                           
             2 INPUTRGN_EXT1 FIXED BIN(31),                             
             2 INPUT_EXCP DIMENSION(224),                               
              3 INPUTDDN_EXT1 CHAR(8),                                 
              3 INPUTBLK_EXT1 FIXED BIN(31),                           
              3 INPUTBSZ_EXT1 FIXED BIN(15),                           
             2 FILLER1 CHAR(1);
and we are getting the compilin error
"The size ( 4195 ) of the record conflicts with the RECSIZE ( 3700 ) specified in the ENVIRONMENT attribute. "

Declaration for the file:
DCL DATA FILE RECORD ENVIRONMENT (FB RECSIZE(3700));
And the read statement is:
READ FILE(DATA) INTO (INPUT_RECORD_FORMAT_EXT);


Please help me, and if you want any other info, i will post.
Back to top
View user's profile Send private message
prino

Active User


Joined: 07 Feb 2009
Posts: 225
Location: Oostende, Belgium

PostPosted: Mon Jul 06, 2009 4:34 pm    Post subject: Re: Reply to: Data declarations to convert the COBOL progra
Reply with quote

Is it so ffing difficult to use "CODE" tags???

Cobol:

Kotes wrote:
05 INPUT-EXCP OCCURS 255 TIMES


PL/I:

Kotes wrote:
2 INPUT_EXCP DIMENSION(224),


Kotes wrote:
2 FILLER1 CHAR(1);


And why do you think you need to add a 1-character filler?
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 4221
Location: Atlanta, GA

PostPosted: Mon Jul 06, 2009 5:36 pm    Post subject:
Reply with quote

I ran the posted COBOL structure through the compiler and it tells me the structure length is 3683 bytes, so your data isn't 3700 bytes long to start with.
Back to top
View user's profile Send private message
Kotes

New User


Joined: 03 May 2005
Posts: 24

PostPosted: Tue Jul 07, 2009 10:09 am    Post subject: Reply to: Data declarations to convert the COBOL program to
Reply with quote

Dear Robert,

Yes, the length of the input structure in COBOL is 3683 as you told, and data also less that or equal to 3683 only.
We defined as 3700, and that file is using for other strucuture also there it will use 3700 bytes.

Robert, how to initialize the group variable in PL/I like in COBOL initialize ws-group.

Thanks,
Kotes
Back to top
View user's profile Send private message
prino

Active User


Joined: 07 Feb 2009
Posts: 225
Location: Oostende, Belgium

PostPosted: Tue Jul 07, 2009 10:41 am    Post subject:
Reply with quote

Use unions in PL/I and '' to initialise a whole structure.
Back to top
View user's profile Send private message
Kotes

New User


Joined: 03 May 2005
Posts: 24

PostPosted: Tue Jul 07, 2009 1:46 pm    Post subject: Reply to: Data declarations to convert the COBOL program to
Reply with quote

Dear Prino,

Could you give any small example with under one structure/union with 6 elements and different data types.

It will help us to understand very clearly, I read the Language reference, but not clear.

If possible provide the corresponding PL/I layout for first post.

Thanks,
Back to top
View user's profile Send private message
dbzTHEdinosauer

Senior Member


Joined: 20 Oct 2006
Posts: 3385
Location: germany

PostPosted: Tue Jul 07, 2009 2:13 pm    Post subject:
Reply with quote

Kotes wrote:
...I read the Language reference, but not clear.

That is because you did not read the Programming Guide first, then you will be able to understand the REFERENCE.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> PL/I & ASSEMBLER All times are GMT + 6 Hours
Page 1 of 1