View previous topic :: View next topic
|
Author |
Message |
anoop_mf
New User
Joined: 27 Sep 2005 Posts: 6
|
|
|
|
hi how can we pass tables from one pgm to another.
Why 77 level is used as an elementary level. |
|
Back to top |
|
|
priyesh.agrawal
Senior Member
Joined: 28 Mar 2005 Posts: 1448 Location: Chicago, IL
|
|
|
|
Quote: |
hi how can we pass tables from one pgm to another. |
Are they passed, from one prog to another.... You include tables in your program....
May be I m wrong... Plz correct....
Quote: |
Why 77 level is used as an elementary level. |
Because 66 is used in RENAME & 88 in Conditional.
Regards,
Priyesh. |
|
Back to top |
|
|
iknow
Active User
Joined: 22 Aug 2005 Posts: 411 Location: Colarado, US
|
|
|
|
Hi anoop_mf,
Quote: |
hi how can we pass tables from one pgm to another |
Your question looks vague. What Priyesh said is right. Tables are used to improve the efficiency of programs.
One solution to my undestanding is you can code the FD section for the file in a separate program and access the program by using TABLES along with INDEX.
Example
Say your FD code is in "FDPGM.CBL"
Inside the main program under FILE SECTION use this statement,
COPY "FDPGM.CBL"
Code: |
FDPGM.CBL
* Primary Key - STATE-CODE
* NAME is required
* NAME and CODE should be uppercase
*--------------------------------
FD STATE-FILE
LABEL RECORDS ARE STANDARD.
01 STATE-RECORD.
05 STATE-CODE PIC X(2).
05 STATE-NAME PIC X(20). |
Filling a table from a file.
Code: |
Under FILE SECTION use COPY "FDPGM.CBL in the main program"
01 TABLE-STATE-RECORD OCCURS 50 TIMES
INDEXED BY STATE-INDEX.
05 TABLE-STATE-CODE PIC XX.
05 TABLE-STATE-NAME PIC X(20). |
Make use of INDEX variable in your main program
Code: |
SET STATE-INDEX TO 1.
PERFORM PARA-A
UNTIL STATE-INDEX > 50 OR
TABLE-STATE-RECORD(STATE-INDEX) = SPACE |
.
Hope you got some understanding on how to use tables along with INDEX variable.
Please correct me if I am wrong.
Quote: |
2)Why 77 level is used as an elementary level. |
Elementary level item. Cannot be subdivisions of other items (cannot be qualified), nor can they be subdivided themselves.
01 level can have sublevels from 02 to 49. 77 cannot have sublevel. |
|
Back to top |
|
|
prasad43
New User
Joined: 21 Oct 2005 Posts: 7 Location: blore
|
|
|
|
plz clarify this one,
49 level is elementary or not?
If it is elementary why we cannot useinstead of 77? |
|
Back to top |
|
|
reddy007
New User
Joined: 22 Dec 2005 Posts: 1
|
|
|
|
Yes , 49 is elementry |
|
Back to top |
|
|
Sankh_a
New User
Joined: 28 Dec 2005 Posts: 1 Location: India
|
|
|
|
Quote: |
2)Why 77 level is used as an elementary level. |
If your data definition is as follows
01 var-1.
03 var-2 pic 9.
03 var-3 pic x.
03 var-4 pic x.
Then the data will be placed in adjecent memory locations.
But if you use 77 level it will be placed arbitrarily in memory.
This may increase your processing time as it might take more time to fetch data from individual memory location.
Correct me if I am wrong.
Thanks
Sankha[/quote] |
|
Back to top |
|
|
Nanda Krishna
New User
Joined: 30 Nov 2005 Posts: 19 Location: Bangalore
|
|
|
|
plz clarify this one,
49 level is elementary or not?
If it is elementary why we cannot useinstead of 77?
Hi Prasad,
49 level is not Elementary. Plz see the explanation from iknow ...
"Elementary level item Cannot be subdivisions of other items " ..... you can't use 49 level item independently. It will come under 01 level.
But, it is not the case with 77. Hope now u got the diff. b/n 49 and 77 level no's. |
|
Back to top |
|
|
mmwife
Super Moderator
Joined: 30 May 2003 Posts: 1592
|
|
|
|
You can pass tables like this:
Main pgm.
Code: |
01 tbl.
05 tbl-entry occurs 10 times indexed by tbl-idx.
10 a ....
10 b ....
call pgmx using tbl. |
Sub pgm.
Code: |
WS.
01 sub-tbl.
05 tbl-entry occurs 10 times indexed by tbl-idx.
10 a ....
10 b ....
LS.
01 tbl pic x(???) where ??? is the total length of the Main pgm's tbl.
PD using tbl.
move tbl to sub-tbl.
|
You could also reference the tbl in the sub by using a subscript. In that case you can define the tbl in the Linkage Sect (LS), but don't use the INDEX clause.
You might also want to look at the GLOBAL/EXTERNAL features of COBOL. I haven't used them so I can't venture an opinion.
Re. level 49:
I know it's used exclusively for DB2 data items. I can't remember exactly; either the length field for variable length data items or the null indicator. |
|
Back to top |
|
|
|