Is there any way I can pass parameter from natural Program to JCL and use the same in next step of JCL
I want to write a record to a workfile with different variables. How can I achieve this is one program?
WRITE WORKFILE 1 #DATA
WRITE WORFILE 1 #DATA-1
- I don’t think so.
- Look up the VARIABLE option of WRITE WORK FILE.
WRITE WORK FILE 1 VARIABLE #DATA . . . WRITE WORK FILE 1 VARIABLE #DATA-1
- Sure you can!
In the first step you define the workfile:
//CMWKF01 DD DSN=STEP1.OUTPUT,DISP=...
In the second, you use that as the CMSYNIN:
//CMSYNIN DD DSN=STEP1.OUTPUT,DISP=...
Of course, this does mean that the first program also needs to output the logon information, the program to execute and the FIN.
Thanks Daniel and Jerome
If you don’t want to include the logon information, you can still use DD concatenation especially if you have passwords in the logon information.
Is Daniel’s reply an answer to question 1 or 2? If it is #1, could i get some further details? I have asked this question internally and usually get asked “Why would you want to do that?”
I want to take the value of a text variable that is determined within the Natural program and be able to use in later steps in the JCL. I am extremely new to Natural and JCL. Please be gentle.
Saw your brother Wal the other day.
Anyway - what you are saying you want to do may be different than what was originally asked, but the concept is the same and can be applied.
All you are asking is can you take the contents of a variable in an earlier step and save that value for use by a program in a later step. This can be done solely by using work files / datasets, which doesn’t have to be as fancy as was described. Simply write out the contents of the variable to a dataset you define as CMWKFnn in your JCL and do a WRITE WORK nn #variable. Then in the later step, also reference the same dataset as CMWKFnn and do a READ WORK nn #variable, and you now have its value.
The fancy part in what was mentioned is that they are stacking the variable into the CMSYNIN DD card which you probably have as inline in your existing JCL. You just do something like what’s above in the first program, but you need to write to CMWKFnn not just the variable contents but also everything else you currently write into the inline CMSYNIN.
If you put your variable contents in there, you can INPUT the value into your variable in the program in the later step. Just instead of having the inline CMSYNIN, you have CMSYNIN DD DSN=dataset.created.in.earlier.step.
Hope this helps!
That would be my uncle.
More specifically, I want to be able to use the text value in a PAUSE statement in the JCL
The other hurdle that I face is the lack of current reference material. The JCL book that I have access to does not show anything about the CMSYNIN DD card. We do have a search tool but I can not get any hits in our existing JCL code that uses the mentioned card.
I am working my way through Google searches but extremely tedious.
Again, I am so new to JCL that I do not know enough to know if I am putting together a good question. I come from the iSeries world and can do what I want very easily.
Thanks for the replies.
Do you mean //*PAUSE which halts the input control reader?
I am not familiar with its use if that is so, but if you can use it and reference the contents of a dataset for your purposes, then the concept would be the same. If this JECL function cannot access the content of a dataset, I don’t see how you can do what you need to do.
Maybe someone else can advise?
From IBM’s documentation: http://publib.boulder.ibm.com/infocenter/zos/v1r11/index.jsp?topic=/com.ibm.zos.r11.ieab600/xj3paus.htm
What are you actually trying to do in your JCL? Do you need to write a message to the operator?
//CMSYNIN DD statement is an input dataset. If you find examples in your reference of //SYSIN DD statements, they are the same as //CMSYNIN. The “SYSIN” and “CMSYNIN” are names used by the application programs to refer to the input dataset.
Here is a very abbreviated version of my JCL. My intent is to provide concept of what I am doing. Names have been changed to protect the guilty.
// DLBL CMWKF01,‘WORK.FILE1’,SD
- $$ SLI SNATBAT
// RESET ALL
// EXEC FTPBATCH
// IF $RC = 0 THEN
// PAUSE message based on data processed in NATPGM
// RESET ALL
- $$ EOJ
The Natural program NATPGM builds a report file that needs to be printed on preprinted forms. The name of the preprinted form is included in the data from WORK.FILE1. I would like to be able to pass that data to the PAUSE message so that the operator will notified that the job has completed and which preprinted forms to prepare and load.
I would like to thank all of you for the responses. I am going to use NATRJE to do what I want. I can find examples of doing that.
If you need to write a message to the operator, the CMWTO routine (example in SYSEXTP) might be what you need.
0160 DEFINE DATA 0170 LOCAL 0180 1 MSG (A50) INIT <'THIS IS AN OPERATOR TEST MESSAGE'> 0190 END-DEFINE 0200 CALL 'CMWTO' USING MSG 0210 END
Thanks again for the response. However, I am going to stay with using NATRJE call. It gives me the control of when to issue the pause message at a time when it is needed.
Please do not spend any further time on this matter.