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

IDCAMS listcat service using cobol


IBM Mainframe Forums -> JCL & VSAM
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
sandeep.kumar

New User


Joined: 16 Aug 2021
Posts: 11
Location: India

PostPosted: Fri Oct 08, 2021 9:28 pm
Reply with quote

Kevin wrote:
I'm not sure why you're insisting on doing this within a jobstream when that's not possible.

Here's an option:
Code:

//STEP0001 EXEC PGM=CHECKDSN,PARM='&CLIENT..CHECKDSN.IDCAMS'
//STEPLIB DD DISP=SHR,DSN=&SYSUID..COBOL.LOAD
//SYSIN DD UNIT=VIO,DISP=(,DELETE),RECFM=FB,LRECL=80
//SYSPRINT DD SYSOUT=*
//*
//STEP0002 EXEC PGM=IKJEFT01,PARM='%CHECKDSN &CLIENT..CHECKDSN.IDCAMS'
//SYSPROC DD DISP=SHR,DSN=&SYSUID..CLIST
//SYSTSIN DD DUMMY
//SYSTSPRT DD SYSOUT=*
//*
//STEP0003 EXEC PGM=IKJEFT01,PARM='%CHECKDSN &CLIENT..CHECKDSN.IDCAMS'
//SYSPROC DD DISP=SHR,DSN=&SYSUID..REXX
//SYSTSIN DD DUMMY
//SYSTSPRT DD SYSOUT=*
//*


where:

Code:

COBOL:

IDENTIFICATION DIVISION.
PROGRAM-ID. CHECKDSN.

ENVIRONMENT DIVISION.
INPUT-OUTPUT SECTION.

FILE-CONTROL.
SELECT SYSIN-FILE ASSIGN TO UT-S-SYSIN
ORGANIZATION IS SEQUENTIAL
ACCESS IS SEQUENTIAL.

DATA DIVISION.
FILE SECTION.

FD SYSIN-FILE
LABEL RECORD STANDARD
BLOCK 0 RECORDS
RECORDING MODE F
RECORD CONTAINS 80 CHARACTERS.
01 SYSIN-RECORD PIC X(80).

WORKING-STORAGE SECTION.

LINKAGE SECTION.
01 PARM.
03 PARM-LENGTH PIC S9(04) COMP SYNC.
03 THE-PARM.
05 THE-DATASET-NAME PIC X(44).

PROCEDURE DIVISION USING PARM.
INSPECT THE-PARM
REPLACING ALL LOW-VALUES BY SPACES.
DISPLAY THE-PARM.
OPEN OUTPUT SYSIN-FILE.
MOVE SPACES TO SYSIN-RECORD.
STRING ' LISTCAT ENT('
DELIMITED BY SIZE
THE-DATASET-NAME
DELIMITED BY SPACES
') ALL'
DELIMITED BY SIZE
INTO SYSIN-RECORD.
WRITE SYSIN-RECORD.
CLOSE SYSIN-FILE.
CALL 'IDCAMS'.
STOP RUN.


Code:

CLIST:

PROC 1 THEDSN
LISTCAT ENT('&THEDSN') ALL
EXIT CODE(&LASTCC)


Code:

REXX:

/* REXX */
"LISTCAT ENT('"ARG(1)"') ALL"
EXIT RC


It’s always return 0000 in Cobol. I have executed cobol program with catalog flat file and uncatalog flat file(ps) but in both cases CALL ‘IDCAM’ returns 000000. Can you please help me out? how to get correct result?
_________________
sandeep kumar
Back to top
View user's profile Send private message
Rohit Umarjikar

Global Moderator


Joined: 21 Sep 2010
Posts: 2792
Location: NYC,USA

PostPosted: Sat Oct 09, 2021 6:15 pm
Reply with quote

What is it that you want to know ? Please use a code tags when showing us the code.
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 -> JCL & VSAM

 


Similar Topics
Topic Forum Replies
No new posts COBOL-DB2 COBOL Programming 5
No new posts Make cobol variable value a variable COBOL Programming 3
No new posts how to convert and use 1 bit hex-numb... COBOL Programming 10
No new posts VB file copy COBOL program gives erro... COBOL Programming 3
No new posts Cobol program to determine the sequen... COBOL Programming 2
Search our Forums:

Back to Top