|
|
| Author |
Message |
Kotes
New User
Joined: 03 May 2005 Posts: 24
|
|
|
|
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
|
|
| Back to top |
|
 |
References
|
|
 |
enrico-sorichetti
Global Moderator
Joined: 14 Mar 2007 Posts: 5388 Location: italy
|
|
|
|
| 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
show which data types do not match and somebody will gladly help |
|
| Back to top |
|
 |
Kotes
New User
Joined: 03 May 2005 Posts: 24
|
|
|
|
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 |
|
 |
prino
Active User
Joined: 07 Feb 2009 Posts: 225 Location: Oostende, Belgium
|
|
|
|
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 |
|
 |
Robert Sample
Global Moderator
Joined: 06 Jun 2008 Posts: 4235 Location: Atlanta, GA
|
|
|
|
| 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 |
|
 |
Kotes
New User
Joined: 03 May 2005 Posts: 24
|
|
|
|
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 |
|
 |
prino
Active User
Joined: 07 Feb 2009 Posts: 225 Location: Oostende, Belgium
|
|
|
|
| Use unions in PL/I and '' to initialise a whole structure. |
|
| Back to top |
|
 |
Kotes
New User
Joined: 03 May 2005 Posts: 24
|
|
|
|
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 |
|
 |
dbzTHEdinosauer
Senior Member
Joined: 20 Oct 2006 Posts: 3385 Location: germany
|
|
|
|
| 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 |
|
 |
|
|
|