Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Data Definition 2

Status
Not open for further replies.

fabiousa

MIS
Aug 13, 2001
45
BR
Hey guys, I am sorry if I may sound stupid. But this is the best place I have found on the net to ask my questions. So far, I have had answers to all my problems.

I was looking at a COBOL code and found the following definitions:

05 XYZ(3,2)
06 ABC(3,2) pic X.

05 XYZ(3,3)
06 ABC(3,2) pic X.

05 XYZ(3,4)
06 ABC(3,4) pic X.


What's the meaning of the values in parenthesis?
Thanks a lot!
Fabio
 
The answer simply put is the first value is position in the record and the second is the length.
 
I don't think so. It is no valid COBOL. It looks a little bit like working-storage, but it isn't. It looks a bit like PL/1 but I am not sure about that.

This is what my compiler says:

Code:
     1 000100 IDENTIFICATION DIVISION.                                                        20NOV01 19:49:23  PAGE    1
     2 000200 PROGRAM-ID. test.
     3 000300 AUTHOR.
     4 000400 DATA DIVISION.
     5 000500 WORKING-STORAGE SECTION.
     6 001000    05 XYZ(3,2)
     7 001100       06  ABC(3,2) pic X.
     8 001200
     9 001300    05 XYZ(3,3)
    10 001400       06  ABC(3,2) pic X.
    11 001500
    12 001600    05 XYZ(3,4)
    13 001700       06  ABC(3,4) pic X.
    14 002100 PROCEDURE DIVISION.
    15 002300 01.
    16 002500     GOBACK.
CA-Realia COBOL Version 4.209        Site: 134792    TEST.COB                                20NOV01 19:49:23  PAGE    2

LINE ERR# LVL                    ERROR TEXT

   6 0253 E 01 level missing before 'XYZ'
   6 0259 E No PICTURE supplied for 'XYZ'
   6 0115 E Unrecognizable word or literal '('
   6 0123 W Space assumed after ','
   6 0138 W Period assumed before '2'
   6 0259 E No PICTURE supplied for '2'
   6 0115 E Unrecognizable word or literal ')'
   6 0138 W Period assumed before ')'
   7 0138 W Period assumed before 'ABC'
   7 0259 E No PICTURE supplied for 'ABC'
   7 0115 E Unrecognizable word or literal '('
   7 0123 W Space assumed after ','
   7 0138 W Period assumed before '2'
   7 0259 E No PICTURE supplied for '2'
   7 0115 E Unrecognizable word or literal ')'
   7 0138 W Period assumed before ')'
   9 0256 W FILLER group assumed after previous element for 'XYZ'
   9 0259 E No PICTURE supplied for 'XYZ'
   9 0115 E Unrecognizable word or literal '('
   9 0123 W Space assumed after ','
   9 0138 W Period assumed before '3'
   9 0259 E No PICTURE supplied for '3'
   9 0115 E Unrecognizable word or literal ')'
   9 0138 W Period assumed before ')'
  10 0138 W Period assumed before 'ABC'
  10 0259 E No PICTURE supplied for 'ABC'
  10 0115 E Unrecognizable word or literal '('
  10 0123 W Space assumed after ','
  10 0138 W Period assumed before '2'
  10 0259 E No PICTURE supplied for '2'
  10 0115 E Unrecognizable word or literal ')'
  10 0138 W Period assumed before ')'
  12 0256 W FILLER group assumed after previous element for 'XYZ'
  12 0259 E No PICTURE supplied for 'XYZ'
  12 0115 E Unrecognizable word or literal '('
  12 0123 W Space assumed after ','
  12 0138 W Period assumed before '4'
  12 0115 E Unrecognizable word or literal ')'
  12 0138 W Period assumed before ')'
  13 0138 W Period assumed before 'ABC'
  13 0259 E No PICTURE supplied for 'ABC'
  13 0115 E Unrecognizable word or literal '('
  13 0123 W Space assumed after ','
  13 0138 W Period assumed before '4'
  13 0115 E Unrecognizable word or literal ')'
  13 0138 W Period assumed before ')'

test     has  23 Warning  +  23 E Level  messages
CA-Realia COBOL Version 4.209        Site: 134792    TEST.COB                                20NOV01 19:49:23  PAGE    3

                                        

                        Realia COBOL Compiler Version Information

                              Pass 1     Version 4.209
                              Pass 1a    Version 4.205
                              Pass 2     Version 4.222
                              Pass 2a    Version 4.202
                              Pass 4     Version 4.209


                        Compilation Directives in Effect

COMP-4            NODCHK            OPT               NOCALL
NOSUBCHK          STRCHK            ANSITRUNC         NOSMALLCOMP
NODCALL           NODIVZERO         NOEPDCALL         APOST
ASCII             STATABORT         MOVELINK          NOBLL4K
ARGCHK            UPLOW             WRITEAFTER        SOSI
NOCOPY68          MD:  200          NOFLAG-COM        NOFLAG-SEG
NOFLAG-FIPS       NODEBUG           DIALECT-REALIA4

                        Error level limit: W

                        Source lines compiled:        16
                        Compilation time (mm:ss.ss):  0:00.17
                        Compilation speed (lines/minute):  5647

                        Compilation date (yy/mm/dd): 01/11/20
                             Time of day (hh:mm:ss): 19:49:23

                        Source length in LST file:000000507

Have fun!

Crox
 
IF the second value is the length, why should I use PIC X then?

Thanks
 
I agree with Crox: this is the first time I've seen something like this be called a COBOL code. But then again I'm no expert... but from all I've read in this forum Crox is a very good authority.
 
Guys,

From what I understand, I have 3 record layouts. All of them with the same name and with the clause OCCURS in them.
So, it should be like XYZ(3,2) -- field XYZ from the third record, ocurrence number 2.
I didn't show you the whole code but it should be something like:

05 XYZ(1,1) PIC X
05 XYZ(1,2) PIC X
05 XYZ(1,3) PIC X
05 XYZ(2,1) PIC X
05 XYZ(2,2) PIC X
05 XYZ(2,3) PIC X
05 XYZ(3,1) PIC X
05 XYZ(3,2) PIC X
05 XYZ(3,3) PIC X

This would represent 3 record layouts with 3 occurences for each field. As I can understand here, the programmer who coded this, wanted to store some historical data.

Please don't tell me I am crazy...It's here, it's a COBOL application.

Regards,

Fabio
 
It is COBOL not PL/1! I dont recall which version. It could be COBOL 390 its definatly COBOL. The X represents the alpha numeric not the size of the picture. CROX is using the CA compiler which is not a true IBM compiler. His compiler is not recognizing the space after the comma.

Check out the folks from ADPAC. They might help.
 
Please don't show us "pieces of code". That OCCURS makes a difference.. and we still don't know where it is in your data description. "Garronteed" also, you need periods after each PIC X (or did you leave out some more code????)
Also, please always specify the compiler you are using.
We can't give you accurate answers unless we have coherent questions.

Stephen J Spiro
ANSI COBOL Standards Committee
 
Fabio,

The data configuration you describe would look something like this in just about any version of cobol extant:

01 xyz-tbl.
05 level-1 occurs 3 times.
10 level-2 occurs 3 times.
15 xyz pic x.

I'm no expert with PC COBOL, so maybe there is something like you describe in one of those, but I doubt it. Perhaps you're working w/a COBOL code generator.

To repeat SJS and paraphrase Cuba Gooding Jr., "Show us the code".

Regards, Jack.
 
Hi,

The CA compiler is - if you use it in mainframe look-alike mode - much more reliable than other pc compilers when it comes to mainframe compatibility. For example: MF is very friendly for all kinds of mis-use of the a-margin. The mainframe is not and CA-REALIA is also not.

For all those people whom think that the source has anything to do with COBOL 390, here is some syntax description.

By the way, the reason why it feels a little bit like PL/1 is because of the format (3,2) which is used in PL/1 to define things like amount of ciphers and precision.

The idea of some generator or pre-processor code is ok. Also: perhaps it has something to do with something like a screen section for some compiler?

Regards,

Crox

Code:
5.3.1 Format 1




Format 1 is used for data description entries in all Data Division sections.


    ___ Format 1 ___________________________________________________________
   |                                                                        |
   | >>__level-number__ _____________ __ __________________ ______________> |
   |                   |_data-name-1_|  |_redefines-clause_|                |
   |                   |_FILLER______|                                      |
   |                                                                        |
   | >__ ________________________ __ _________________ ___________________> |
   |    |_blank-when-zero-clause_|  |_external-clause_|                     |
   |                                                                        |
   | >__ _______________ __ __________________ __ _______________ ________> |
   |    |_global-clause_|  |_justified-clause_|  |_occurs-clause_|          |
   |                                                                        |
   | >__ ________________ __ _____________ __ _____________________ ______> |
   |    |_picture-clause_|  |_sign-clause_|  |_synchronized-clause_|        |
   |                                                                        |
   | >__ ______________ __ ______________ __ ______________________ _____>< |
   |    |_usage-clause_|  |_value-clause_|  |_ date-format-clause _|        |
   |                                                                        |
   |________________________________________________________________________|

Note: The clauses can be written in any order with two exceptions:


  If data-name or FILLER is specified, it must immediately follow the
  level-number.


  When the REDEFINES clause is specified, it must immediately follow data-name
  or FILLER, if either is specified. If data-name or FILLER is not specified,
  the REDEFINES clause must immediately follow the level-number.




Level-number in format 1 can be any number from 01-49 or 77.


A space, a separator comma, or a separator semicolon must separate clauses.
 
I am really sorry I didn't post all the code. I thought that piece would be enough. I will show you the code as soon as I have time but first I need to change the names of the fields because of some confidentiality issues.

Also, I am pretty sure I can see the DOTS after PIC X.

If I put PIC X, isn't it assuming it's an alphanumeric of 1 byte? As XX would be 2 bytes?
Look I am not being cinical here, but English and COBOL are not my first language.

Thanks and sorry!

Fabio
 
Fabio,

Is this SOURCE code you are showing us, or something that came out of the compilation already? I am showing my ignorance here but I do confess I am bewitched, bothered and bewildered by this issue...

This looks very much like a Fileaid (that's a Compuware product) view of an interpreted record layout...

 
Winzip,

Thanks for your input.
You are right, it's not File/Aid. I have been looking into the source code and couldn't find anything like I said before. When I open Net Express I can see it, though.
Perhaps this is something created by Net Express.
However, there are lots of codes using parentheses. The one below is an example:

MOVE ABC(1,2) to ABC(2,2)

Fabio
 
Hi Fabio,

Well, well, well. We finally get something recognizable. If you wanted to move the 2nd element of the 1st &quot;record&quot; as you called it, to the 2nd element of the 2nd &quot;record&quot;,
you'd reference the table I defined earlier, with:

MOVE XYZ(1,2) to XYZ(2,2)

Don't know where you got those data defs you showed us. It may help if you told us the circumstances of your situation, e.g., &quot;I was asigned the task of converting a set of programs from COBOL X to COBOL Y. While looking at the code of one pgm (a compiler listin? the actual source code? on-line debug o/p?) I found .....

Regards, Jack.

 
Thanks Jack!
My task is to convert an old COBOL code (Microfocus 1997) to a new one. I just need to understand some pieces of the code that need to be changed and recompile it.
The definitions of those data appeared to me in Net Express. I assumed it was part of the code, but as I can see now, it's not there.

To tell you the truth, I've been struggling to use the Windows platform.
I am a CICS systems programmer (OS390) and never touched application programs. Worse yet, in COBOL. Basically my backgraund is in assembler (mainframe), which I consider to be far easier than COBOL.
 
Hi Fabio,

I'm a recovering sysprog myself and I find COBOL a LOT easier than BAL. Take a weekend to page thru a COBOL manual, by Monday you'll be an expert (almost).

Being a sysprog, you probably didn't write many report pgms in BAL. If you did you couldn't say BAL is easier than COBOL.

There's an old saying that says &quot;if all you have is a hammer, every problem looks like a nail&quot;. A corollary to that, I guess, is &quot;if somebody takes away your hammer and gives you a nail gun without the manual, you better wear steel tipped shoes&quot;.

Regards, Jack.
 
Fabio,

Glad to be of service... Was also a sysprog in a previous life (but that was in the stone age) and I don't know if I will still recognize BAL.

Yeah, you will find a lot of the 'type' of code you showed us. When you do spend the time reading that manual as Jack suggested, focus on topics such as arrays or table processing and you will re-encounter that code. Your example is when you are handling a two-dimensional table: the figures inside the parentheses are either called subscripts or indices or pointers. To imagine a 2-dimensional table, think of a spreadsheet - you have rows and you have columns and to point to an item in your spreadsheet you specify the row and column address. That is what you are seeing in your example: DATANAME (integer1, integer2) where integer1 corresponds to the ROW and integer2 corresponds to the COLUMN.

COBOL is not bad... it should be a walk in the park for you once you've browsed through a manual.

Enjoy.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top