Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Profile Log in to check your private messages Log in
 
How to pass tables in program

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> Mainframe Interview Questions
View previous topic :: :: View next topic  
Author Message
anoop_mf

New User


Joined: 27 Sep 2005
Posts: 6

PostPosted: Tue Dec 13, 2005 7:27 pm    Post subject: How to pass tables in program
Reply with quote

hi how can we pass tables from one pgm to another.

Why 77 level is used as an elementary level.
Back to top
View user's profile Send private message

priyesh.agrawal

Senior Member


Joined: 28 Mar 2005
Posts: 1452
Location: Chicago, IL

PostPosted: Tue Dec 13, 2005 9:23 pm    Post subject: Re: How to pass tables in program
Reply with quote

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.

icon_cool.gif Because 66 is used in RENAME & 88 in Conditional.

Regards,

Priyesh.
Back to top
View user's profile Send private message
iknow

Active User


Joined: 22 Aug 2005
Posts: 413
Location: Colarado, US

PostPosted: Wed Dec 14, 2005 6:57 am    Post subject: Re: How to pass tables in program
Reply with quote

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
View user's profile Send private message
prasad43

New User


Joined: 21 Oct 2005
Posts: 7
Location: blore

PostPosted: Tue Dec 27, 2005 1:57 pm    Post subject: hi
Reply with quote

plz clarify this one,
49 level is elementary or not?
If it is elementary why we cannot useinstead of 77?
Back to top
View user's profile Send private message
reddy007

New User


Joined: 22 Dec 2005
Posts: 1

PostPosted: Tue Dec 27, 2005 2:19 pm    Post subject:
Reply with quote

Yes , 49 is elementry
Back to top
View user's profile Send private message
Sankh_a

New User


Joined: 28 Dec 2005
Posts: 1
Location: India

PostPosted: Wed Dec 28, 2005 3:35 pm    Post subject: Re: How to pass tables in program
Reply with quote

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
View user's profile Send private message
Nanda Krishna

New User


Joined: 30 Nov 2005
Posts: 19
Location: Bangalore

PostPosted: Thu Dec 29, 2005 4:16 pm    Post subject:
Reply with quote

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
View user's profile Send private message
mmwife

Super Moderator


Joined: 30 May 2003
Posts: 1592

PostPosted: Sun Jan 01, 2006 4:47 am    Post subject:
Reply with quote

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
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> Mainframe Interview Questions All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts How to write Rexx program to size and... sreejeshcs CLIST & REXX 14 Thu Oct 12, 2017 7:26 am
No new posts Accessing CICS tran with map from JCL... navdeepaggarwal CICS 5 Tue Oct 03, 2017 6:15 pm
No new posts Writing a file using online program grvtomar PL/I & Assembler 3 Fri Jun 30, 2017 1:06 pm
No new posts pre-compiler for program in an HFS Pedro DB2 0 Fri Jun 23, 2017 11:13 pm
No new posts Identify top 30 big tables or indexes... ashek15 DB2 0 Fri Jun 16, 2017 10:01 am

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us