Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Profile Log in to check your private messages Log in
 
REXX code - Empty file check

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> CLIST & REXX
View previous topic :: :: View next topic  
Author Message
senmainframe
Currently Banned

New User


Joined: 09 Oct 2007
Posts: 30
Location: USA

PostPosted: Mon Nov 12, 2007 10:34 pm    Post subject: REXX code - Empty file check
Reply with quote

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
View user's profile Send private message

superk

Moderator Team Head


Joined: 26 Apr 2004
Posts: 4650
Location: Raleigh, NC, USA

PostPosted: Mon Nov 12, 2007 10:43 pm    Post subject: Reply to: REXX code - Empty file check
Reply with quote

Please post your runtime TRACE output.
Back to top
View user's profile Send private message
enrico-sorichetti

Global Moderator


Joined: 14 Mar 2007
Posts: 10326
Location: italy

PostPosted: Mon Nov 12, 2007 10:45 pm    Post subject: Reply to: REXX code - Empty file check
Reply with quote

Code:
        "ISPEXEC REMPOP"   


what has that statement in common with what You are trying to achieve ??
Back to top
View user's profile Send private message
cpuhawg

Active User


Joined: 14 Jun 2006
Posts: 331
Location: Jacksonville, FL

PostPosted: Mon Nov 12, 2007 11:32 pm    Post subject:
Reply with quote

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
View user's profile Send private message
senmainframe
Currently Banned

New User


Joined: 09 Oct 2007
Posts: 30
Location: USA

PostPosted: Tue Nov 13, 2007 12:45 am    Post subject:
Reply with quote

Thank you verymuch. I will take this.
Back to top
View user's profile Send private message
senmainframe
Currently Banned

New User


Joined: 09 Oct 2007
Posts: 30
Location: USA

PostPosted: Tue Nov 13, 2007 12:55 am    Post subject:
Reply with quote

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
View user's profile Send private message
cpuhawg

Active User


Joined: 14 Jun 2006
Posts: 331
Location: Jacksonville, FL

PostPosted: Tue Nov 13, 2007 1:38 am    Post subject: Reply to: REXX code - Empty file check
Reply with quote

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
View user's profile Send private message
enrico-sorichetti

Global Moderator


Joined: 14 Mar 2007
Posts: 10326
Location: italy

PostPosted: Tue Nov 13, 2007 2:52 am    Post subject: Reply to: REXX code - Empty file check
Reply with quote

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
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> CLIST & REXX All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts How to write Rexx program to size and... sreejeshcs CLIST & REXX 14 Thu Oct 12, 2017 7:26 am
This topic is locked: you cannot edit posts or make replies. Rexx to execute spool commands upendrasri CLIST & REXX 5 Wed Oct 04, 2017 6:54 am
No new posts Execute JCL step based on the content... sprikitik JCL & VSAM 2 Tue Oct 03, 2017 10:03 am
This topic is locked: you cannot edit posts or make replies. PS file data should be passed as symb... d_sarlie JCL & VSAM 15 Tue Oct 03, 2017 5:18 am
This topic is locked: you cannot edit posts or make replies. Rexx to execute spool commands upendrasri CLIST & REXX 47 Fri Sep 29, 2017 1:08 pm

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us