Skip to main content

Dynamic dataset allocation using MFJSZ099 / SVC99 - Create a new dataset

  • February 16, 2013
  • 2 replies
  • 0 views

Created On:  08 February 2011

Problem:

How can I allocate and catalog a dataset from within a COBOL batch program? 

Resolution:

The utility MFJSZ099 simulates the IBM mainframe DYNALLOC assembler macro, which uses SVC99 to perform dynamic allocation of datasets from within a batch program.

One of the available functions is to create and catalog a new dataset, using a program-defined dataset name, which can then be written to from within the same run unit.

The attached example consists of two Cobol programs, and one JCL file. The preparation of the necessary control blocks (text units) required by MFJZS099, and the call to MFJZS099 have been packaged within the program NEWDSN2. This is called by NEWDSN1, which accepts a parameter containing the dataset name to be allocated.

In this example, the DDname to which the dataset will be allocated, and the dataset's DCB information are hard-coded within NEWDSN2, but of course these could also be specified externally, and passed as parameters to NEWDSN2, and then fed through to MFJZS099.

N.B. Because the copybooks used to map the parameters to MFJZS099 (which are identical to those used by SVC99) contain in-line comments and comp-x variables, it cannot be compiled with DIALECT"ENTCOBOL", unless the additional directives FLAG"MF" and MF"12" are specified. Additionally, you may wish to override the ENTCOBOL character set (EBCDIC) using the CHARSET"ASCII" directive.
Incident #2490720

Attachments

Old KB# 33286

#MFDS
#EnterpriseDeveloper

2 replies

  • Author
  • Rocketeer
  • 19312 replies
  • July 18, 2017
Created On:  08 February 2011

Problem:

How can I allocate and catalog a dataset from within a COBOL batch program? 

Resolution:

The utility MFJSZ099 simulates the IBM mainframe DYNALLOC assembler macro, which uses SVC99 to perform dynamic allocation of datasets from within a batch program.

One of the available functions is to create and catalog a new dataset, using a program-defined dataset name, which can then be written to from within the same run unit.

The attached example consists of two Cobol programs, and one JCL file. The preparation of the necessary control blocks (text units) required by MFJZS099, and the call to MFJZS099 have been packaged within the program NEWDSN2. This is called by NEWDSN1, which accepts a parameter containing the dataset name to be allocated.

In this example, the DDname to which the dataset will be allocated, and the dataset's DCB information are hard-coded within NEWDSN2, but of course these could also be specified externally, and passed as parameters to NEWDSN2, and then fed through to MFJZS099.

N.B. Because the copybooks used to map the parameters to MFJZS099 (which are identical to those used by SVC99) contain in-line comments and comp-x variables, it cannot be compiled with DIALECT"ENTCOBOL", unless the additional directives FLAG"MF" and MF"12" are specified. Additionally, you may wish to override the ENTCOBOL character set (EBCDIC) using the CHARSET"ASCII" directive.
Incident #2490720

Attachments

Old KB# 33286

#MFDS
#EnterpriseDeveloper

HI,

I have been trying to execute the sample you have given, but it is failing for-

Execution error : file 'idas099' error code: 114, pc=0, call=1, seg=0 114 Attempt to access item beyond bounds of memory (Signal 11) 10:34:36.

I have compiled using DIALECT(MF). But I have my Charset as EBCDIC. I tried doing ASCII, but it gave the same error with few more errors.

Can you please suggest what I have been doing wrong.


  • Author
  • Rocketeer
  • 19312 replies
  • April 2, 2020
Created On:  08 February 2011

Problem:

How can I allocate and catalog a dataset from within a COBOL batch program? 

Resolution:

The utility MFJSZ099 simulates the IBM mainframe DYNALLOC assembler macro, which uses SVC99 to perform dynamic allocation of datasets from within a batch program.

One of the available functions is to create and catalog a new dataset, using a program-defined dataset name, which can then be written to from within the same run unit.

The attached example consists of two Cobol programs, and one JCL file. The preparation of the necessary control blocks (text units) required by MFJZS099, and the call to MFJZS099 have been packaged within the program NEWDSN2. This is called by NEWDSN1, which accepts a parameter containing the dataset name to be allocated.

In this example, the DDname to which the dataset will be allocated, and the dataset's DCB information are hard-coded within NEWDSN2, but of course these could also be specified externally, and passed as parameters to NEWDSN2, and then fed through to MFJZS099.

N.B. Because the copybooks used to map the parameters to MFJZS099 (which are identical to those used by SVC99) contain in-line comments and comp-x variables, it cannot be compiled with DIALECT"ENTCOBOL", unless the additional directives FLAG"MF" and MF"12" are specified. Additionally, you may wish to override the ENTCOBOL character set (EBCDIC) using the CHARSET"ASCII" directive.
Incident #2490720

Attachments

Old KB# 33286

#MFDS
#EnterpriseDeveloper

PLEASE PROVIDE VALID LINK TO SOURCE CODE!

https://dl.microfocus.com/_ex/community/knowledgebase/TelligentArticleResources/1017_NEWDSN.zip