View previous topic :: View next topic
|
Author |
Message |
senmainframe Currently Banned New User
Joined: 09 Oct 2007 Posts: 30 Location: USA
|
|
|
|
Hi,
I am checking empty dataset in REXX using the following code. If empty file I am allocationg two files and if it is not empty, I am leavin g
What is the wrong in this. I am not getting proper result
Code: |
"ALLOC DD(INDD) DA('CAA1035.EMPTY.CHECK') SHR REU"
"EXECIO 1 DISKR INDD (STEM IN. FINI"
Return_Code = RC
"ISPEXEC REMPOP"
If Return_Code = 2 Then
Do
Say 'allocate'
End
Exit 0
|
|
|
Back to top |
|
|
superk
Global Moderator
Joined: 26 Apr 2004 Posts: 4652 Location: Raleigh, NC, USA
|
|
|
|
Please post your runtime TRACE output. |
|
Back to top |
|
|
enrico-sorichetti
Superior Member
Joined: 14 Mar 2007 Posts: 10873 Location: italy
|
|
|
|
what has that statement in common with what You are trying to achieve ?? |
|
Back to top |
|
|
cpuhawg
Active User
Joined: 14 Jun 2006 Posts: 331 Location: Jacksonville, FL
|
|
|
|
I use this REXX program to check for empty files. It works very similiar to your code:
Code: |
/* ---------- REXX: RESTRUCTURED EXTENDED EXECUTOR LANGUAGE --------- */
/* EMPTY RETURNS A COND COND OF 04 */
/* RECORDS RETURN A COND COND OF 00 */
PARSE ARG DSN
IDSN = STRIP(DSN,'B')
ALLOC:
"ALLOC FI(INPUTCK) DA('"||IDSN||"') SHR REUSE"
IF RC > 0 THEN DO
SAY "ALLOCATE ERROR RC= " RC
EXIT RC
END
READUMIN:
/* READ IN THE INPUT FILES AS STEM VARIABLES */
"EXECIO 1 DISKR INPUTCK (STEM IN.. FINIS)"
ADDRESS TSO "FREE F(INPUTCK)"
IF IN.0 = 0 THEN EXIT 4
IF IN.0 ¬= 0 THEN EXIT 0
|
It brings in a dataset as an argument and attempts to READ one record. It then checks the zero stem variable and passes a RC of 0 if there are records and a RC of 4 if there are not records. You can probably adapt this to your requirement. |
|
Back to top |
|
|
senmainframe Currently Banned New User
Joined: 09 Oct 2007 Posts: 30 Location: USA
|
|
|
|
Thank you verymuch. I will take this. |
|
Back to top |
|
|
senmainframe Currently Banned New User
Joined: 09 Oct 2007 Posts: 30 Location: USA
|
|
|
|
Hi,
See the below code. If empty condition, it is perfectly going inside the loop, but why it is not creating the new dataset. After executing this rexx. I am not able to see the new dataset.
CPDTT.CIF.SYST.BLK#OC13.CIFMCH3M.AXAB300N - Empty dataset
Code: |
300_alloc:
/* getting new block string from panel */
NEWBLOCK = 'OC13'
say 'here newblock' newb
"ALLOC DD(INDD) DA('CPDTT.CIF.SYST.BLK#"NEWBLOCK".CIFMCH3M.AXAB300N')
SHR REU"
"EXECIO 1 DISKR INDD (STEM IN. FINI"
Return_Code = RC
say 'retrun code ' rc
If Return_Code = 2 Then
say 'inside rcc ' return_code
Do
Call Msg('OFF')
Psname1 = "CPDTT.CIF.SYST."NEWBLOCK".CIFMCH5M.AXAB4004"
say 'dataset1 : ' psname1
"Alloc FI(SORTOUT) DA("Psname1") NEW UNIT(SYSDA)",
"SP(10, 90) TRA DSORG(PS) DIR(0) BLKSIZE(27896)",
"LRECL(317) RECFM(F B) REUSE"
Call Msg('On')
Call Msg('OFF')
Psname2 = "CPDTT.CIF.SYST."NEWBLOCK".CIFMCH5M.AXAB4005"
"Alloc FI(SORTOUT) DA("Psname2") NEW UNIT(SYSDA)",
"SP(10, 90) TRA DSORG(PS) DIR(0) BLKSIZE(27993)",
"LRECL(301) RECFM(F B) REUSE"
Call Msg('On')
End
Return |
The output say messages
here1
here newblock OC13
retrun code 2
inside rcc 2
dataset1 : CPDTT.CIF.SYST.OC13.CIFMCH5M.AXAB4004
here end
*** |
|
Back to top |
|
|
cpuhawg
Active User
Joined: 14 Jun 2006 Posts: 331 Location: Jacksonville, FL
|
|
|
|
I'm do not see anything specific that is wrong with your ALLOC statements.
I would ask?
Is SP valid for the word SPACE?
Is TRA valid for TRACKS?
If its is a PS dataset, you do not need DIR(0).
Do the DA("Psname1") and DA("Psname2") parameters need to have a single quote surrounding them? Like DA('"PSNAME1"') and DA('"PSNAME2"')?
You can always add TRACE "I" at the top of the code you are running and TRACE OFF at the bottom to see how REXX performs your instructions. |
|
Back to top |
|
|
enrico-sorichetti
Superior Member
Joined: 14 Mar 2007 Posts: 10873 Location: italy
|
|
|
|
Code: |
"Alloc FI(SORTOUT) DA("Psname2") NEW UNIT(SYSDA)",
"SP(10, 90) TRA DSORG(PS) DIR(0) BLKSIZE(27993)",
"LRECL(301) RECFM(F B) REUSE" |
I do not see anything telling the system whart to do with Your dataset...
I would add the operand "CATLG" ..
To be sure,check with SDSF the log of Your tso session
to see what happens when You free the ddname/dataset |
|
Back to top |
|
|
|