IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

display variable in call prog when exec the called prog


IBM Mainframe Forums -> COBOL Programming
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
Bahugun

New User


Joined: 07 Jul 2010
Posts: 24
Location: hyderabad

PostPosted: Fri Nov 11, 2011 6:35 pm
Reply with quote

hi all,
i am presently testing cobol code
example the programs are pm5054 and pm5020

the coobat program pm5054 calls the program pm5020

i want a variable lets say ERROR-STATUS of of 129 bytes which is present in pm5020 program to be displayed in sysout when i run the program pm5054 .

thanks in advance
Bahugun
Back to top
View user's profile Send private message
expat

Global Moderator


Joined: 14 Mar 2007
Posts: 8796
Location: Welsh Wales

PostPosted: Fri Nov 11, 2011 6:38 pm
Reply with quote

Well that's just fantastic and now we all know what you want.

What have you done so far yourself, and what errors do you need help with.

I'm sure a few of the COBOL fraternity will have some more questions for you.
Back to top
View user's profile Send private message
Parvinder Singh

New User


Joined: 06 Sep 2011
Posts: 6
Location: india

PostPosted: Fri Nov 11, 2011 6:59 pm
Reply with quote

Give Display for Error-Status in pm5020, compile it . recompile pm5054 then run your job. You will get Error-Status contents in sysout. Hope this helps !!!
Back to top
View user's profile Send private message
Bahugun

New User


Joined: 07 Jul 2010
Posts: 24
Location: hyderabad

PostPosted: Fri Nov 11, 2011 7:02 pm
Reply with quote

i have already tried that but it is not gettign deisplayed.thats why i am asking help .
Back to top
View user's profile Send private message
arindam111

New User


Joined: 29 Nov 2006
Posts: 27
Location: India

PostPosted: Fri Nov 11, 2011 7:10 pm
Reply with quote

You might want to check your run JCL. Your program run step should have something like -

//SYSOUT DD SYSOUT=*
Back to top
View user's profile Send private message
Bahugun

New User


Joined: 07 Jul 2010
Posts: 24
Location: hyderabad

PostPosted: Fri Nov 11, 2011 7:12 pm
Reply with quote

//SYSOUT DD SYSOUT=*

it is present in the step where i am calling the pm5054 program in jcl.
Back to top
View user's profile Send private message
Bill Woodger

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Fri Nov 11, 2011 7:16 pm
Reply with quote

Can you show the code and the data definitions in 5020, Linkage Section, any relevant Workng Storage, Procedure Division using, please.
Back to top
View user's profile Send private message
Bahugun

New User


Joined: 07 Jul 2010
Posts: 24
Location: hyderabad

PostPosted: Fri Nov 11, 2011 7:22 pm
Reply with quote

*PROCEDURE DIVISION USING WS-INPUT-CITY, WS-OTHER-PARMS.
LINKAGE SECTION.
01 ZZ-USINGPARM1 PIC X(3).
01 ZZ-USINGPARM2 PIC X(341).
PROCEDURE DIVISION USING ZZ-USINGPARM1 , ZZ-USINGPARM2 .
GO TO ZZ-BYPASS-DMSII-SECTION.
ZZ-DMSII-SECTION SECTION.
Back to top
View user's profile Send private message
Bill Woodger

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Fri Nov 11, 2011 7:25 pm
Reply with quote

Where in ZZUSINGPARM2 is the thing you want to display? Where is your attempt to display it, the DISPLAY statement and a couple of lines around it, please.
Back to top
View user's profile Send private message
Bill Woodger

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Fri Nov 11, 2011 7:32 pm
Reply with quote

Parvinder Singh wrote:
Give Display for Error-Status in pm5020, compile it . recompile pm5054 then run your job. You will get Error-Status contents in sysout. Hope this helps !!!


Curious as to why you'd feel the need to recompile 5054 if not suggesting any changes there. I can't see it as anything but a waste of time?
Back to top
View user's profile Send private message
Bahugun

New User


Joined: 07 Jul 2010
Posts: 24
Location: hyderabad

PostPosted: Fri Nov 11, 2011 7:35 pm
Reply with quote

the varable i want to display is
PMS-ERROR-STATUS (129)

* THIS WORKING STORAGE
01 PMS-ERROR-STATUS-AREA.
02 PMS-ERROR-STATUS-INDICATORS.
03 PMS-ERROR-STATUS PIC X(129).
03 PMS-ERROR-STATUS-R REDEFINES ESI-ERROR-STATUS.
05 ESI-GROUP PIC 9(01).
ETC...

like that it is redefineed many times in the program as per the requirements

i just searched where the some data is moved in the program .below that i specified the below display step
example
MOVE PMS-ERROR-STATUS TO WS-PMS-ERRORS
DISPLAY " PMS-ERROR-STATUS:" PMS-ERROR-STATUS

regards
Bahugun
Back to top
View user's profile Send private message
Bahugun

New User


Joined: 07 Jul 2010
Posts: 24
Location: hyderabad

PostPosted: Fri Nov 11, 2011 7:39 pm
Reply with quote

it is not ESI it is PMS please do not get confused


* THIS WORKING STORAGE
01 PMS-ERROR-STATUS-AREA.
02 PMS-ERROR-STATUS-INDICATORS.
03 PMS-ERROR-STATUS PIC X(129).
03 PMS-ERROR-STATUS-R REDEFINES PMS-ERROR-STATUS.
05 PMS-GROUP PIC 9(01).
ETC...

example
MOVE PMS-ERROR-STATUS TO WS-PMS-ERRORS
DISPLAY " PMS-ERROR-STATUS:" PMS-ERROR-STATUS
Back to top
View user's profile Send private message
Bill Woodger

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Fri Nov 11, 2011 8:12 pm
Reply with quote

I think we'd best start again, as I'm getting more confused rather than less.

Program 5054

Calls 5020

5020 has the 129-byte error status in Working Storage

You want to display that error status.

Am I right so far?

When you run 5054 (EXEC PGM=blahblah5054) you want to display the error-status that is in 5020 to be displayed at a point which is relevant.

I thought you wanted either to display data from 5054, or do the display in 5054, but it seems now that all mention of 5054 might be a red-herring.

You have a DISPLAY in 5020 which is not being executed.

You have the SYSOUT DD, so the most likely cause is a logic error in5020.

All we have seen of the code in 5020 is a GO TO statement.

We need to see more of your code. You have sections, so let's see the whole SECTION where the display is, and any/all code which deals with entering that section.
Back to top
View user's profile Send private message
Bahugun

New User


Joined: 07 Jul 2010
Posts: 24
Location: hyderabad

PostPosted: Fri Nov 11, 2011 8:19 pm
Reply with quote

i am running the jcl for PM5054.
the cobbat program of PM5054 calls the program PM5020.
the variable PMS-ERROR-STATUS is present in PM5020.

i want the PMS-ERROR-STATUS to be displayed in SYSOUT of the jcl PM5054(as PM5054 is calling PM5020 program internally)

the code is very big to be shared

as per my understandng
where ever there is a move statement in the code of PM5020 i have given display statement below it.

i have recomplied the PM5020 program after that

now when i run the jcl for the program PM5054 i need the varable value be displayed in the SYSOUT of this JCL

regards
Bahugun
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6966
Location: porcelain throne

PostPosted: Fri Nov 11, 2011 8:31 pm
Reply with quote

Bill,
aren't you glad you asked?
i am. thought this was going to be a dull afternoon.
Back to top
View user's profile Send private message
Bill Woodger

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Fri Nov 11, 2011 8:32 pm
Reply with quote

OK, we'll get there.

A couple of things I want you to add to both programs.

Code:

01  W-WHEN-COMPILED                      PIC X(8)BX(8).


Code:

MOVE WHEN-COMPILED           TO W-WHEN-COMPILED
DISPLAY "your-prog-name-here This program compiled on "
                                                            W-WHEN-COMPILED


This will show you that you are using the correct versions of the programs (or not).

You only need to do this once in each program.

This will also show that the DISPLAY "works".

Confirm that please, and we get to the next bit.[/code]
Back to top
View user's profile Send private message
Marso

REXX Moderator


Joined: 13 Mar 2006
Posts: 1353
Location: Israel

PostPosted: Sat Nov 12, 2011 3:53 pm
Reply with quote

Bahugun wrote:
*PROCEDURE DIVISION USING WS-INPUT-CITY, WS-OTHER-PARMS.
LINKAGE SECTION.
01 ZZ-USINGPARM1 PIC X(3).
01 ZZ-USINGPARM2 PIC X(341).
PROCEDURE DIVISION USING ZZ-USINGPARM1 , ZZ-USINGPARM2 .
GO TO ZZ-BYPASS-DMSII-SECTION.
ZZ-DMSII-SECTION SECTION.
What has this to do with your question ? Yes, I am confused.
Bahugun wrote:
it is not ESI it is PMS please do not get confused
I googled for PMS... Now I am even more confused! icon_eek.gif
Back to top
View user's profile Send private message
Parvinder Singh

New User


Joined: 06 Sep 2011
Posts: 6
Location: india

PostPosted: Mon Nov 14, 2011 2:45 pm
Reply with quote

Bill Woodger wrote:
Parvinder Singh wrote:
Give Display for Error-Status in pm5020, compile it . recompile pm5054 then run your job. You will get Error-Status contents in sysout. Hope this helps !!!


Curious as to why you'd feel the need to recompile 5054 if not suggesting any changes there. I can't see it as anything but a waste of time?


Sorry Bill, I should write relink instead of recompile, If 5052 is called from 5054 and is static than it should be relinked. Please correct if i am wrong.
Back to top
View user's profile Send private message
Bill Woodger

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Mon Nov 14, 2011 2:49 pm
Reply with quote

Yes, if the call is static it would need to be re-linked. If dynamic everything would just be happy.

Maybe TS has discovered that he wasn't, in whatever way, executing his changed version of the program.
Back to top
View user's profile Send private message
Bahugun

New User


Joined: 07 Jul 2010
Posts: 24
Location: hyderabad

PostPosted: Tue Nov 15, 2011 4:05 pm
Reply with quote

hi all,

i was thinking of different process.

lets declare a varible ERR1 in PM5054 program.
then when the PM5054 program calls PM5020.
then we can move the PMS-ERROR-STATUS to ERR1

and when the control comes back to PM5054 program then we can give the display statement for the ERR1 variable.

i think this process will work.
but i do not know how to implement it

if anyone know how this can be done please let me know.

regards
Bahugun
Back to top
View user's profile Send private message
Bill Woodger

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Tue Nov 15, 2011 5:03 pm
Reply with quote

You need to define a new field in the Linkage Section.

Depending how the existing definitions are used, it can be added to an existing definition or added as a new 01-level. If a new 01-level the CALL ... USING and the PROCEDURE DIVISION USING have to both name new data, and some storage needs to be defined in the calling program.

Then change all your DISPLAYs to MOVEs to the new definition in the Linkage Section, and put a new DISPLAY statement after the CALL in the calling program.
Back to top
View user's profile Send private message
Bahugun

New User


Joined: 07 Jul 2010
Posts: 24
Location: hyderabad

PostPosted: Tue Nov 15, 2011 5:49 pm
Reply with quote

could you pls explain it in the coding point of veiw by taking a small example.that would really help me.

regards
Bahugun
Back to top
View user's profile Send private message
Bill Woodger

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Tue Nov 15, 2011 5:57 pm
Reply with quote

In calling program.

Code:
In working-storage
01  A-THING-TO-DISPLAY PIC X(129).

In procedue
CALL PROGX USING FIRST-EXISTING-DATA-DEFINITION
                 SECOND-EXISTING-DATA-DEFINITION
                 A-THING-TO-DISPLAY
DISPLAY ">" A-THING-TO-DISPLAY "<"


In called program.

Code:
In Linkage
01  SOME-NAME-TO-HOLD-THE-MESSAGE PIC X(129).

In procedure
PROCEDURE DIVISIONS USING FIRST-LINKAGE
                          SECOND-LINKAGE
                          SOME-NAME-TO-HOLD-THE-MESSAGE
                          .

Do something which generates message
MOVE THE-MESSAGE TO SOME-NAME-TO-HOLD-THE-MESSAGE


If you want more, I need the Spec and some means of receiving money from you :-)
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> COBOL Programming

 


Similar Topics
Topic Forum Replies
No new posts REXX/CMS How to place command console... CLIST & REXX 4
No new posts CA7 count with DATE variable CA Products 0
No new posts Call an hlasm from REXX in batch and ... CLIST & REXX 4
No new posts Extracting Variable decimal numbers f... DFSORT/ICETOOL 17
No new posts JCL EXEC PARM data in C Java & MQSeries 2
Search our Forums:

Back to Top