I am setting up a JCL which will pass value of date coming from a sequential file (has one record) (example 20190320) to parm as shown below:
//STEP1 EXEC PGM=ABC,PARM='20190320'
I am trying to pass value of PARM with value of date containing inside sequential file.
Assuming that your COBOL program already contain instructions to retrieve the information passed from JCL using PARM, you may use the PARMDD parameter in conjunction with a DD statement to achieve the task. The DD statement is to define the sequential file with PARM data.
//STEP1 EXEC PGM=ABC,PARMDD=MYINPUT
//MYINPUT DD DISP=SHR,DSN=MY.PARM.INPUT
//SYSOUT DD SYSOUT=*
Dataset MY.PARM.INPUT can have the value of date.
Basically, you can't pass more than 100 bytes of data using PARM parameter. PARMDD is usually preferred if you want to pass data > 100 bytes.
Hope this helps.
You can not do this in the one job.
Options include
Changing the program ABC to read from the file
Writing a program/rexx to read the file and call the program ABC
Read the file and Generate a new job that calls ABC with the date you have just read. This could be done in a rexx script.
Some scheduling systems might support this.
Please provide a bit more information
What scheduling system does your company use
Is the program ABC a locally written program ??? that can be changed
Is the job part of a batch stream run automatically or submitted by a user.
Manual Submission
If the job is being submitted manually you could
Write a Rexx Script using ISPF file tailoring to generate && submit the JCL
Rexx Macro to update and submit the JCL
ISPF Edit macro
you could have
// set DATE=$Date$
//STEP1 EXEC PGM=ABC,PARM='&date'
in the jour JCL
and have the rexx edit macro
read the file
do a replace all on &date
I would use the same variables as Controlm
With JCL
// set DATE=$Date$
//STEP1 EXEC PGM=ABC,PARM='&date'
the edit macro would some thing like
/* rexx */
ADDRESS ISREDIT 'macro'
Address TSO "EXECIO 1 DISKR indd"
pull date
ADDRESS ISREDIT "r $date$" date
ADDRESS ISREDIT "cancel"
The edit macro needs to be in the SYSPROC or SYSEXEC libraries. If the
Macro is called ChgDate you would just
Related
I got the below error when trying to read the input value using SYSIN from PDS member.
//SYSIN DD DSN=SYSGEN.DEVL.GBUYVC.GDPR.CODE(PFMA342X),DISP=SHR
And in Cobol I mentioned below accept statement:
ACCEPT W-QUOTE-CURRENT-YEAR FROM SYSIN.
I got the below error when I submitted the job
Error: open of DISPLAY or ACCEPT file with environment name SYSIN was
unsuccessful.
Can someone help me understand where I am doing mistake?
Hi Thanks for taking time and giving your valuable inputs.
Actually in JCL I was using a Proc that does not accept SYSIN so i removed that PROC and simply executed the JCL like
//STEP01 EXEC PGM=progname,
//SYSIN DD DSN=Datasetname,DISP=SHR
This way it worked
I am actually converting all DDS files to use MSGID instead of plain text. I can now change the display language of the application just by choosing the right library with the MSGF in French, English, ...
But for the commands, it seems that CRTCMD needs a language file at compile time (with PMTFILE) and uses theses strings to generate the command. I could eventually delete the MSGF but the command will display the texts.
What I want to achieve is using the same *CMD object and be able to change the language when needed at run time.
**Edit: assuming a currently supported release, 6.1 or higher...
I think you want to use *DYNAMIC on the CRTCMD PMTFILE() parameter
*DYNAMIC
When the command is prompted, prompt text messages
will be dynamically retrieved from the message file
specified for this parameter using the message
identifiers stored in the *CMD object when the command
was created. The message identifier specified for the
PROMPT or CHOICE parameter on a CMD, PARM, QUAL, or
ELEM command definition statement must be found in the prompt text
message file when the command is being prompted.
So something like
CRTCMD CMD(MYLIB/MYCMD) PGM(MYLIB/MYPGM) SRCFILE(MYLIB/QCMDSRC)
SRCMBR(MYCMD) PMTFILE(*LIBL/MYMSGF *DYNAMIC)
I have a code in SAS.
proc sql;
create test as select * from test2 where user_name = &username;quit;
when I Run in SAS EG with %let username=Bob it runs normal.
But I need to run it with stored Process (variable username is internal parameter in connected user and I delete %let username=Bob from sas stored process code).
Stored Process brake with an error.
In log file I see variable:
_username=Bob but code in stored process can not find it. How to use this variable in SAS Stored process code? Thank you!
In your own SAS code, you use a macro variable username, but in your stored process, the user name is available in the reserved macro variable _username. The underscore is really part of the variable name, so you should write &_username.
For more information, you can read the documentation or you can consult the log after inserting
%put _automatic_;
in your code, to print all macro variables SAS provided for you.
Remark: As the automatic macro variables in a stored process differ from that in a local SAS session, if you want to use the same code in both, you often need some %if %then %else logic.
I have a spss syntax file that I need to run on multiple files each in a different directory with the same name as the file, and I am trying to too do this automatically. So far I have tried doing it with syntax code and am trying to avoid doing python is spss, but all I have been able to get is the code bellow which does not work.
VECTOR v = key.
LOOP #i = 1 to 41.
GET
FILE=CONCAT('C:\Users\myDir\otherDir\anotherDir\output\',v(#i),'\',v(#i),'.sav').
DATASET NAME Data#i WINDOW=FRONT.
*Do stuff to the opened file
END LOOP.
EXE.
key is the only column in a file that contains all the names of the files.
I am having trouble debugging since I don't know how to print to the screen if it is possible. So my question is: is there a way to get the code above to work, or another option that accomplishes the same thing?
You can't use an expression like that on a GET command. There are two choices. Use the macro language to put this together (see DEFINE in the Command Syntax Reference via the Help menu) or use the SPSSINC PROCESS FILES extension command or your own Python code to select the files with a wildcard.
The extension command or a Python program require the free Python Essentials available from the SPSS Community website or available with your Statistics version.
Is it possible to abend your job intentionally through COBOL program.
suppose I have an Input file having Header,Detail and Trailer records. I will write a COBOL pgm which reads this file.If no Detail records are found in this file then I want to abend my job by giving some Abend Message and some Abend Code.Is it Possible?
Do you want to ABEND your program or just set a RETURN-CODE?
I suspect setting a RETURN-CODE, writing a message
and then terminating the program via a STOP RUN or GOBACK is all that
you really want to do. Causing an actual ABEND may not be necessary.
In an IBM batch environment, the RETURN-CODE set by your program becomes the
RC for the JCL job step the program was run under. This is typically what you
want to set and test for.
The RETURN-CODE is set by MOVEing a numeric value to it. For example:
DISPLAY 'No Detail Records found in file.'
MOVE 16 TO RETURN-CODE
GOBACK.
You may also issue a program dump from a program run under Language Environment (IBM
Mainframe option) using
the CEE3DMP--Generate dump
utility.
In older IBM Mainframe COBOL programs, you might see calls to the ILBOABN0 routine. This call
abended your program and issued a dump. This routine is now depreciated in favour of the
technique outlined above.
Finally, really old programs might have code in them to generate abends. This can be done in any number of ways, but division by zero was
often a favourite:
DIVIDE SOME-NUMBER BY ZERO GIVING SOME-NUMBER.
Works every time!
Personally, I recommend setting the RETURN-CODE over calling ILBOABN0 or data-exception tehcniques.
Note: The RETURN-CODE special-register is not part of the COBOL-85 standard. It is available as an IBM extention to the language. You may need to resort to a different mechanism if you are working in a non-IBM compatible environment.
see the following link on how to set the return code passed back to a JCL job step as well as force an Abened code.
http://www.tek-tips.com/viewthread.cfm?qid=1058302&page=22
First, you should check what is accepted by your own shop's/site's working standards. Most teams will already have an accepted way to deliberately abend a program for a 'logic' reason. One company I worked at has a very simple program called SYSABND2, which I believe is written in assembler, which is called just to abend the program.
That said, to ABEND (not just set return code), you should call module CEE3ABD (or previous version ILBOABN0, which is now deprecated).
For details, see:
https://www.ibm.com/support/knowledgecenter/SSLTBW_2.4.0/com.ibm.zos.v2r4.ceea300/clcdump.htm
http://publib.boulder.ibm.com/infocenter/zvm/v5r4/index.jsp?topic=/com.ibm.zos.r9.ceea400/ceea4150320.htm
One method for doing an abnormal end of run is to output a message to the user terminal or to the operator at a mainframe computer centre and possibly to a printer if necessary, all depending on the type of computer the program is to be run on. In cobol it is possible to use DISPLAY UPON .. and use an identifier for the terminal, operator console, or printer as defined in an entry in the SPECIAL-NAMES section of the ENVIRONMENT DIVISION. An example may be similar to this using the correct device names for your case
OPERATOR-CONSOLE IS OUT-OP2 in special-names with DISPLAY "RUN ERROR - NO DETAIL RECORDS, ABORTING" UPON OUT-OP2 and
DISPLAY "REPORT TO OPERATIONS MANAGER" UPON OUT-OP2 and STOP RUN. in procedure division.
A reference to the circumstance would need to be included in any job or macro and operating instructions.
Yes, it is possible to abend your job intentionally through COBOL program by simply calling one module which doesn't exist. It will give S806 abend code.