Posts

Showing posts from March, 2021

Dynamic Allocation of PS Dataset Using a COBOL program.

Image
 Hi Mainframe, In most of Mainframe Shops, we use JCL for Allocation of PS Dataset. But Many a times a requirement comes where we need to allocates a PS dataset dynamically within a COBOL program which catalog the Files and once catalog the Allocated PS Dataset can be used to perform various File I/O operations such as Open, Read, Write and Close file. In order to Achieve these IBM has provide many Utility as such Sub program can be called in the COBOL main program as a Static call with the Appropriate TSO command to Allocate a new File Dynamically.  Syntax for PS Data Set Allocations is: DSN(&SYSUID..MVS.TEST.FILE01) NEW TRACKS SPACE(100,100) UNIT(SYSDA) CATALOG The file name is Specified in the DSN and any number of Files can be Allocated using IBM Supplied Utility. The most come IBM Utility Used is: 'PUTENV' This Utility or Subprogram is called STATICALLY with the Above mention DSN details....         ID DIVISION .         PROGRAM-ID .   GETENVX.         AUTHOR.        S

COBOL INSPECT Function

Image
In the real world scenario many a times you required to find the length of string value to do a concatenation or string parse but more commonly is used in the VARCHAR column data type of DB2 table. Hence it becomes important for any application to be aware of the COBOL function available to calculate the length of the input string. one of the very common methods used in COBOL for finding the length of the string is to use a INSPECT function. the INSPECT function majorly are of two times. in this blog I will shows you the following 2 types of INSPECT TALLYING function which help to get the length of string, very much need in teal world scenarios. Basic syntax: Below is the example of the COBOL code which receives data from JCL using instream and PARM parameter instream data received by the COBOL program by issuing a ACCEPT statement whereas, the PARM parameter is received by the COBOL program by using LINKAGE SECTION and by mentioning PROCEDURE USING linkage section structure. you can c