Hello All,
I am new into the Mainframe world. I have gone through rexx manuals and started off with few codes.
I have a scenario where i will get the input from the user and have to create a PDS dataset and then create members dynamically inside the PDS. Where there is a condition if the member is already present then i will reuse them and append the data to the member
SAY 'ENTER THE SETNAME:'
PULL SETNAME
NEWDSN = 'HLQ.REPORT'
NEWDSN = NEWDSN || '.' || SETNAME
SAY NEWDSN
ADDRESS TSO
"ALLOC F(LISTDAT) DS('"NEWDSN"') NEW SPACE (50,20) DIR (10),
DSORG (PO) RECFM (F,B) LRECL (80) BLKSIZE (8000)"
IF SYSDSN("'"NEWDSN"'") = 'OK' THEN
SAY "THE DATASET EXISTS."
ELSE
SAY "THE DATASET DOES NOT EXIST."
ADDRESS TSO
"ALLOC F(INFILE) SHR DS('"DSNAME"')"
/* READ THE DATA to STEM */
"EXECIO * DISKR INFILE (FINIS STEM INDATA."
SAY INDATA.0
INPD = INDATA.1
CALL MEMLIST NEWDSN,"MEM001",INPD
MEMLIST:
PARSE ARG PDS,MEM,DATA
DSN = PDS || "(" || MEM || ")"
SAY 'NEW OUTPUT MEMBER DSN:' DSN /* displaying HLQ.REPORT.SETNAME(MEM001)
ADDRESS TSO
"ALLOC DA('"PDS"("MEM")') F(MYOTDD) NEW"
"EXECIO 0 DISKW MYOTDD (STEM DATA. FINIS"
SAY 'RCE:' RC
"FREE F(MYOTDD)"
Using the above code i m able to create the dataset HLQ.REPORT.SETNAME but the member "MEM001" is not getting created
i checked via ispf panel and it is showing as no members found.
I checked the error code rc and it is 0 as well.
kindly share your thoughts and thanks in advance
Need help in a rexx scenario for creating and updating PDS
-
- Posts: 1
- Joined: Fri Feb 02, 2024 1:03 pm
- Skillset: Assembler, TPF , Rexx
- Referer: GOogle
- sergeyken
- Posts: 458
- Joined: Wed Jul 24, 2019 10:12 pm
- Skillset: Assembler, JCL, Utilities, PL/I, C/C++, DB2, SQL, REXX, COBOL, etc. etc. etc.
- Referer: Internet search
Re: Need help in a rexx scenario for creating and updating P
1. Please, learn how to use the Code button when posting your code and/or data.
2. You can create an empty PDS dataset, with no members added, but you cannot create an empty PDS member without trying to write data into it.
This statement does nothing else but close the dataset:
An "empty member" actually makes no sense, from any point of view.
There is no need to have new member already created before writing real data to this member.
2. You can create an empty PDS dataset, with no members added, but you cannot create an empty PDS member without trying to write data into it.
This statement does nothing else but close the dataset:
Code: Select all
"EXECIO 0 DISKW MYOTDD (STEM DATA. FINIS"
An "empty member" actually makes no sense, from any point of view.
There is no need to have new member already created before writing real data to this member.
Javas and Pythons come and go, but JCL and SORT stay forever.
-
- Posts: 474
- Joined: Thu Mar 10, 2016 5:03 pm
- Skillset: assembler rexx zOS ispf racf smf
- Referer: saw it in the experts foprum thought I could help here
Re: Need help in a rexx scenario for creating and updating P
A couple of things for starters.
You don't have an EXIT statement after "CALL MEMLIST NEWDSN,"MEM001",INPD", which means that the pgm will continue with the MEMLIST subroutine efter the call.
The "ALLOC DA('"PDS"("MEM")') F(MYOTDD) NEW" statement will fail as the dataset exists already, the DISP parameter is for the dataset, not the member.
You call MEMLIST with the value of indata.1 as the 3rd parameter, then it looks as if you try to use that in the EXECIO parameter?
You don't have an EXIT statement after "CALL MEMLIST NEWDSN,"MEM001",INPD", which means that the pgm will continue with the MEMLIST subroutine efter the call.
The "ALLOC DA('"PDS"("MEM")') F(MYOTDD) NEW" statement will fail as the dataset exists already, the DISP parameter is for the dataset, not the member.
You call MEMLIST with the value of indata.1 as the 3rd parameter, then it looks as if you try to use that in the EXECIO parameter?
-
- Posts: 474
- Joined: Thu Mar 10, 2016 5:03 pm
- Skillset: assembler rexx zOS ispf racf smf
- Referer: saw it in the experts foprum thought I could help here
Re: Need help in a rexx scenario for creating and updating P
I'm not quite sure what you want to accomplish with this sequence:
but if the aim is to name the stem to write, then it won't work. Here is one that does:
Code: Select all
INPD = INDATA.1
CALL MEMLIST NEWDSN,"MEM001",INPD
...
MEMLIST:
PARSE ARG PDS,MEM,DATA
...
"EXECIO 0 DISKW MYOTDD (STEM DATA. FINIS"
but if the aim is to name the stem to write, then it won't work. Here is one that does:
Code: Select all
CALL MEMLIST NEWDSN,'MEM001','data.'
...
MEMLIST:
PARSE ARG PDS,MEM,stemname
...
"EXECIO" value(stemname'0') "DISKW MYOTDD (STEM" stemname "FINIS"
-
- Similar Topics
- Replies
- Views
- Last post
-
- 6
- 2980
-
by willy jensen
View the latest post
Thu Dec 05, 2024 11:59 pm
-
-
Creating Unix Directory using COBOL in Unix 0n Z/OS
by Heisenberg » Mon Jun 26, 2023 4:36 pm » in IBM Cobol - 2
- 3013
-
by Robert Sample
View the latest post
Wed Jul 05, 2023 6:36 pm
-
-
- 12
- 2928
-
by sergeyken
View the latest post
Mon Sep 25, 2023 3:33 am
-
- 5
- 2697
-
by Pedro
View the latest post
Sat Feb 06, 2021 4:56 am
-
- 3
- 1954
-
by Robledo
View the latest post
Thu Mar 10, 2022 1:03 pm