View previous topic :: View next topic
|
Author |
Message |
rajesh-amigos Currently Banned New User
Joined: 03 Aug 2007 Posts: 25 Location: India
|
|
|
|
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 |
|
|
ofer71
Global Moderator
Joined: 27 Dec 2005 Posts: 2358 Location: Israel
|
|
|
|
Can you run it with TRACE I?
O. |
|
Back to top |
|
|
Aaru
Senior Member
Joined: 03 Jul 2007 Posts: 1287 Location: Chennai, India
|
|
|
|
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 |
|
|
rajesh-amigos Currently Banned New User
Joined: 03 Aug 2007 Posts: 25 Location: India
|
|
|
|
/*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 |
|
|
|