Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

Whats the answer for this SUBROUTINE program

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming
View previous topic :: :: View next topic  
Author Message
maheshk84

New User


Joined: 04 Jan 2006
Posts: 22
Location: Chennai

PostPosted: Sun Jan 08, 2006 11:39 am    Post subject: Whats the answer for this SUBROUTINE program
Reply with quote

1) IN THE CALLING PROGRAM I USED,

CALL SUB1 USING DD MM YY .

DD, MM, YY ARE DESCRIBED AS PIC 9(2).

IN THE CALLED PROGRAM,

PROCEDURE DIVISION USING DATE.

DATE IS DESCRIBED AS PIC 9(6) WHICH IS JUST A DATA ITEM.

WILL THE VALUE OF DD,MM,YY GET PASSED TO DATE ?

2)

IN THE CALLING PROGRAM I USED,

CALL SUB1 USING DD MM YY .

DD, MM, YY ARE DESCRIBED AS PIC 9(2).

IN THE CALLED PROGRAM,

WHETHER THESE DATA ITEMS SHOULD CORRESPOND TO DATA

ITEMS IN LINKAGE SECTION OR DATA ITEMS USED IN THE PROCEDURE

DIVISION USING PHRASE ?

LINKAGE SECTION.

77 DD PIC 9(2).

77 MM PIC 9(2).

77 YY PIC 9(2).

(OR)

PROCEDURE DIVISION USING DD MM YY .

WHICH OF THE ABOVE IS NECESSARY ?
Back to top
View user's profile Send private message

DavidatK

Active Member


Joined: 22 Nov 2005
Posts: 700
Location: Troy, Michigan USA

PostPosted: Mon Jan 09, 2006 8:49 pm    Post subject: Re: Whats the answer for this SUBROUTINE program
Reply with quote

Good Monday maheshk84,

The answers to Q#1 are: NO, Maybe, But you won?t like it.

NO ? For each using and linkage 01 in the Called program you need to have a corresponding argument in the calling program. The pointers for the linkage 01?s are set to the working storage area in the calling programs working storage.

The linkage section PIC 9(6) will look at 6 contiguous bytes from the storage pointer. If the DD,MM,YY are not in contiguous storage it will not pick up the date you expect.

Maybe ? If the DD,MM,YY are in contiguous storage the linkage PIC 9(6) will pick up the date, but this is dangerous.

But you won?t like it ? When the Calling program calls the subroutine with augments, the location of the NSI (Next Sequential Instruction) is based on the number of arguments in the argument list. If the Calling and Called programs do not match, the Called program will return control to the incorrect address in the Calling program.

The answer to Q#2. You need both, they must correspond to each other. i.e. the first 01 in the linkage section MUST correspond the first USING on the PROCEDURE DIVISION, the second to the second, etc. AND they must correspond to the arguments in the Calling program.
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 -> COBOL Programming All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
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 Compiling program in endeavor for tra... RALAKKAL Compuware & Other Tools 4 Mon Jun 05, 2017 8:27 pm
No new posts COBOL DB2 program - zIIP eligible vasanthz COBOL Programming 7 Wed May 31, 2017 5:12 am
No new posts DB2 Program abending without giving a... rahulgarg14 DB2 7 Mon May 29, 2017 8:10 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us