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

After LISTDSI control doesnt move to next stament


IBM Mainframe Forums -> CLIST & REXX
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
rajesh-amigos
Currently Banned

New User


Joined: 03 Aug 2007
Posts: 25
Location: India

PostPosted: Fri Aug 10, 2007 9:57 pm
Reply with quote

I want to seewhether I can perform a certain Operation on a File. I have writen the following Code for this:-

Code:

/* REXX */
"alloc dataset('"var1"') f(datain)shr reuse"                     
DSINFO=LISTDSI(var3 DIRECTORY)
If SYSREASON !=0 Then DO                                         
 Select                                                         
  When SYSREASON = 3 then Say "Dataset is a type that cannot be processed"               
  When SYSREASON = 5 then Say "Dataset not Cataloged"                                   
  When SYSREASON = 8 then Say "Dataset is not on a DASD"                                 
  When SYSREASON = 9 then Say "DFHSM migrated the Dataset. NORECALL prevents retrieval" 
  When SYSREASON = 11 then Say "You haven't got sufficient authority for this operation" 
  When SYSREASON = 12 then Say "Cannot process VSAM"                                     
  Otherwise Nop
 End       
End                                                             


My problem is that once the function code from LISTDSI is not 0, the control doesnt move to the Select stament, rather it displays the message generated from the system.

Can somebody tell me what can i do to avoid this?
Back to top
View user's profile Send private message
ofer71

Global Moderator


Joined: 27 Dec 2005
Posts: 2358
Location: Israel

PostPosted: Sat Aug 11, 2007 12:36 am
Reply with quote

Can you run it with TRACE I?

O.
Back to top
View user's profile Send private message
Aaru

Senior Member


Joined: 03 Jul 2007
Posts: 1287
Location: Chennai, India

PostPosted: Mon Aug 13, 2007 10:15 am
Reply with quote

Used <> instead of != and is working fine

Code:

/* REXX */                                                         
var1 = "AV5875.BSEUA.OUTPUT"                                       
SAY Var1                                                           
"alloc dataset('"var1"') f(datain)shr reuse"                       
DSINFO=LISTDSI(var3 DIRECTORY)                                     
say sysreason                                                     
If SYSREASON <>0 Then DO                                           
 Select                                                           
  When SYSREASON = 3 then Say "Dataset is a type that"             
  When SYSREASON = 5 then Say "Dataset not Cataloged"             
  When SYSREASON = 8 then Say "Dataset is not on a DAS"           
  When SYSREASON = 9 then Say "DFHSM migrated the Data"           
  When SYSREASON = 11 then Say "You haven't got suffic"           
  When SYSREASON = 12 then Say "Cannot process VSAM"               
  Otherwise Nop                                                   
 End                                                               
End                                                               


output

Code:

 AV5875.BSEUA.OUTPUT                   
 0005                                 
 Dataset not Cataloged                 
 ***                                   
Back to top
View user's profile Send private message
rajesh-amigos
Currently Banned

New User


Joined: 03 Aug 2007
Posts: 25
Location: India

PostPosted: Thu Aug 16, 2007 6:30 pm
Reply with quote

/*REXX */
/*****************************************************
/* This code browses through the PDS given by the user
/* each member in edit mode. The EXEC then runs a ISRE
/* on each of them. The EXEC also writes a report in t
/* errors encountered along with the RC.
/*
/*****************************************************
Trace all
Signal on error name Error_Handler
Signal on failure name Error_Handler

Address tso
Say "Please enter the PDS you want us to traverse"
Pull var1
/*Say "The macro you want to use on the members"
Pull Var2*/
Pull Var2*/

If var1 = "" Then
Do
Say "No PDS name was entered"
Exit
End

var3 = "'"var1"'"
Listc=0
/*"alloc dataset('"var1"') f(datain)shr reuse"*/

/*X=Outtrap(Listc.)*/
DSINFO=LISTDSI(var3 DIRECTORY)
/*X=Outtrap("OFF")*/

Say SYSDSORG
If SYSDSORG = 'PO' Then Do
X=Outtrap(Listc.)
"LISTDS '"var1"' MEMBERS "
X=Outtrap("OFF")

Do I=1 to 3
say listc.i
End
Say "There are " ((Listc.0)-6)" members in the PDS"

"ISPEXEC LMINIT DATAID(datain) DATASET('"var1"')"
Say "Members Returncode"
varcount = 0
Do I=8 to listc.0
Listc.i = STRIP(Listc.i)
Address ISPEXEC "EDIT DATASET('"var1"("listc.i")')
MACRO ("packoff")"
RC_Open = RC
Say listc.i RC
End
End
Else
Do
Say "This file is not a PDS"
Say "However we will still try to process the file"
Address ISPEXEC "EDIT DATASET('"var1"')
MACRO ("packoff")"
End

Error_Handler :
/*If SYSREASON <> 0 Then DO
Say "SYSREASON =" SYSREASON
Select
When SYSREASON == 3 then
Say "Dataset is a type that cannot be processed"
When SYSREASON = 5 then
Say "Dataset not Cataloged Moron"
When SYSREASON == 8 then
Say "Dataset is not on a DASD"
When SYSREASON == 9 then
Say "DFHSM migrated the Dataset. NORECALL prevents retrieval"
When SYSREASON == 11 then
Say "You haven't got sufficient authority for this operation"
When SYSREASON == 12 then
Say "Cannot process VSAM"
Otherwise
End
Exit*/

If RC_OPEN = 14
Say "There were some errors"
Say "The report has been written to the file"
Say Listc.i
End


My Queston is if the Sysreason from LISTDSI is not 0, Then the Control does move to Error_Handler :.

However when the Return code from EDIT DATASET is non zero, the control doesnt move to Error_Handler, instead I get a Screen named ISPF ISRE093, which says "Member in Use". When Runing the code in Trace mode, I found out that the controld goes to ISPF as soon as the code for Editing the open member is encountered.

How can I supress the screen and deliver the message from my own 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 -> CLIST & REXX

 


Similar Topics
Topic Forum Replies
No new posts Using Dynamic file handler in the Fil... COBOL Programming 2
No new posts COBOL - Move S9(11)v9(7) COMP-3 to -(... COBOL Programming 5
No new posts How to move the first field of each r... DFSORT/ICETOOL 5
No new posts Help Control-R IBM Tools 2
No new posts Try to understand IMS control block IMS DB/DC 0
Search our Forums:

Back to Top