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

Why does sysdsn act funny ?


IBM Mainframe Forums -> CLIST & REXX
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
vinaysetlur

New User


Joined: 04 Jan 2008
Posts: 13
Location: United States

PostPosted: Wed Jan 29, 2014 2:11 am
Reply with quote

Hi , I ran into this strange issue that is as follows: -
Method of execution: - TSO
I get the dataset name from the user and pass it using a simple say and pull combination.
I then use queue to push IDCAMS allocate statements into the external data queue and then invoke IDCAMS using Address link.
The call is successfull and the dataset is created.
However when I code a sysdsn check in my program , it says that the dataset is not created.
I am familiar with the 'problem' with quotes on sysdsn . A quick reference says it all. But this is really strange because on a separate standalone invocation of the sysdsn alone, it recognizes and honors the dataset existence.

Here's the code:
Code:
/*   rexx   */
 say ' Pass Dsname   '
 pull dsname
 address tso
"alloc f(sysprint) new reu unit(vio) lrecl(121)",
"recfm(f b) space(1) tra"
"ALLOC F(SYSIN) DUMMY REU "
 q = ''
 q.0 = 3
 q.1 = "   ALLOC DSN('"dsname"') "
 q.2 = "   SPACE(1,1) CYL LRECL(80) BLKSIZE(80) RECFM(F)"
 q.3 = "   DSORG(PS) NEW CAT STORCLAS(STND) "
do i=1 to q.0
   q = q||q.i
end
queue q
queue
 address link 'IDCAMS'
 "free f(sysin sysprint)"
 if rc/=0 then say 'rc = ' rc
 else
   do
       x = sysdsn("'"dsname"'")
       if x  = 'OK' then say 'DS is created !!! '
       else
        say 'Error' X
   end
 exit
Code'd
Back to top
View user's profile Send private message
vinaysetlur

New User


Joined: 04 Jan 2008
Posts: 13
Location: United States

PostPosted: Wed Jan 29, 2014 2:30 am
Reply with quote

Looks like this is because the "dataset only gets created" when the complete exec is run . Because that is one unit of work ?
In other words,
The dataset is not created after the IDCAMS execution and not yet until the last line of the code gets executed.
I am living with this notion currently and keeping the thread open for any different views or ideas on this.

Thanks in anticipation
Back to top
View user's profile Send private message
Pedro

Global Moderator


Joined: 01 Sep 2006
Posts: 2547
Location: Silicon Valley

PostPosted: Wed Jan 29, 2014 11:31 pm
Reply with quote

It is not clear why you use IDCAMS for allocation.

Why not just use TSO?
Code:
 Address TSO "ALLOC DSN('"dsname"') ",
    "   SPACE(1,1) CYL LRECL(80) BLKSIZE(80) RECFM(F)",
    "   DSORG(PS) NEW CAT STORCLAS(STND) "
Back to top
View user's profile Send private message
vinaysetlur

New User


Joined: 04 Jan 2008
Posts: 13
Location: United States

PostPosted: Thu Jan 30, 2014 1:43 am
Reply with quote

That is true . We can use TSO . In fact , we must always so that we keep things straight and simple.

But this was a intended as a demo for my other team members on how to invoke IDCAMS through REXX. So under that intention , I used a simple ALLOC statement for IDCAMS .
Back to top
View user's profile Send private message
steve-myers

Active Member


Joined: 30 Nov 2013
Posts: 917
Location: The Universe

PostPosted: Thu Jan 30, 2014 3:22 am
Reply with quote

vinaysetlur wrote:
...
"ALLOC F(SYSIN) DUMMY REU "
...
address link 'IDCAMS'
"free f(sysin sysprint)"
if rc/=0 then say 'rc = ' rc
else ...
  1. How is IDCAMS even seeing your statements?
  2. I think the return code you are testing is the return code from the TSO FREE command.
Back to top
View user's profile Send private message
sureshpathi10

Active User


Joined: 03 May 2010
Posts: 154
Location: Kuala Lumpur

PostPosted: Thu Jan 30, 2014 8:20 am
Reply with quote

If you comment out the call to IDCAMS also, your dataset will get created. I found that, your code
Code:
 q = ''
 q.0 = 3
 q.1 = "   ALLOC DSN('"dsname"') "
 q.2 = "   SPACE(1,1) CYL LRECL(80) BLKSIZE(80) RECFM(F)"
 q.3 = "   DSORG(PS) NEW CAT STORCLAS(STND) "
do i=1 to q.0
   q = q||q.i
end
queue q 
is generating the Dataset, after the execution by TSO.

and as per your issue about SYSDSN, Since the allocation command processing at the end of your program, there was no information about the file existence at the time of SYSDSN execution.
Back to top
View user's profile Send private message
Pedro

Global Moderator


Joined: 01 Sep 2006
Posts: 2547
Location: Silicon Valley

PostPosted: Thu Jan 30, 2014 8:15 pm
Reply with quote

I have never seen IDCAMS to pull from the TSO stack. Where did you get the idea that it would?

Instead of QUEUEing the command, put them in a SYSIN file before you call IDCAMS.
Back to top
View user's profile Send private message
steve-myers

Active Member


Joined: 30 Nov 2013
Posts: 917
Location: The Universe

PostPosted: Thu Jan 30, 2014 9:13 pm
Reply with quote

Pedro: Agreed, but first he has to write the command to a SYSIN data set that is a real data set, not DUMMY. If he is going to write the lines he has placed in the q array, he has to indicate the first and second lines are continued for IDCAMS.

sureshpathi10: Agreed, but then why is SYSDSN not working? Possibly because of the flawed return code test?

There are so many problems with the Rexx EXEC I think the TS should start over.
  • Use TSO to do the allocation.
  • Forget IDCAMS
  • Test the return code after the allocate command.
  • Free the data set before he exits the Rexx exec.
Back to top
View user's profile Send private message
Pedro

Global Moderator


Joined: 01 Sep 2006
Posts: 2547
Location: Silicon Valley

PostPosted: Thu Jan 30, 2014 10:08 pm
Reply with quote

I recall this from the original poster:
Quote:
intended as a demo ... on how to invoke IDCAMS through REXX
Back to top
View user's profile Send private message
Pedro

Global Moderator


Joined: 01 Sep 2006
Posts: 2547
Location: Silicon Valley

PostPosted: Thu Jan 30, 2014 10:13 pm
Reply with quote

Quote:
sureshpathi10: Agreed, but then why is SYSDSN not working?

He is putting the ALLOCATE in the stack. The stack apparently gets executed after the rexx program completes. At the time of the SYSDSN function, the ALLOCATE is still in the stack and has not yet been executed.
Back to top
View user's profile Send private message
steve-myers

Active Member


Joined: 30 Nov 2013
Posts: 917
Location: The Universe

PostPosted: Thu Jan 30, 2014 10:38 pm
Reply with quote

Just another lesson to me I should not butt in where I really don't know much about Rexx. I deduced he was building something in the queue. Silly me, I thought it was executed immediately! Thanks Pedro.
Back to top
View user's profile Send private message
Pedro

Global Moderator


Joined: 01 Sep 2006
Posts: 2547
Location: Silicon Valley

PostPosted: Thu Jan 30, 2014 11:54 pm
Reply with quote

There are some commands, such as CONSOLE, ACCOUNT, TEST, and IPCS where it will change from 'READY' prompt to some other prompt (or blank). For those commands, I think it will pull subcommands from the stack.

Also, some commands, such as RECEIVE, will prompt the user for missing parameters. I think it will pull from the stack. When you add stuff to the stack, it is not executed immediately, but pulled by the program as needed.

However, IDCAMS is not such a command. To my knowledge, it will not pull from the stack.
Back to top
View user's profile Send private message
sureshpathi10

Active User


Joined: 03 May 2010
Posts: 154
Location: Kuala Lumpur

PostPosted: Fri Jan 31, 2014 9:47 am
Reply with quote

Thanks for backing up Pedro.... As Pedro mentioned earlier, IDCAMS looks for commands to execute in SYSIN file.
Back to top
View user's profile Send private message
vinaysetlur

New User


Joined: 04 Jan 2008
Posts: 13
Location: United States

PostPosted: Sat Feb 01, 2014 2:39 am
Reply with quote

Sorry. I had been out for a while and not following the updates.
I guess , this is what I had also mentioned as my notion and cannot agree any less with Pedro's note: -
Quote:
"The stack apparently gets executed after the rexx program completes. At the time of the SYSDSN function, the ALLOCATE is still in the stack and has not yet been executed."


In other words : -
Quote:
The dataset is not created after the IDCAMS execution and not yet until the last line of the code gets executed.

Also I did try to write to sysin. But it had failed with a different error and that's when i tried to directly put data to the stack via queue and pass that to IDCAMS. I then kept SYSIN dummy .

This was the error I received
    IEC141I 013-34,IGG0191A,E8751AJ,IKJACCNT,SYSIN,VIO , ,,
    SYS14031.T121543.RA000.E8751AJ.R0396963,
    ***,

when I tried to allocate SYSIN as follows: -
Code:
"alloc f(SYSIN) new reu unit(vio) lrecl(80) recfm(f b) space(1) tracks"


Then I looked up the IEC141I 013-34 message and changed recfm to variable with some blocksize for sysin as follows: -
Code:
"alloc f(SYSIN) new reu unit(vio) lrecl(80) recfm(v) space(1) tracks blksize(800)"

and it worked OK. But the sysdsn doesn't detect the dataset which is because of the dataset not getting created yet at the time of call.
Thanks , this thread may now be closed
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 Funny, but actually not funny at all... General Talk & Fun Stuff 1
No new posts SYSDSN fails on 3rd dataset during logon CLIST & REXX 1
No new posts Some funny COBOL 'PIC'tures COBOL Programming 2
No new posts Allegedly Funny Stuff General Talk & Fun Stuff 5
No new posts Problem with SYSDSN parameter for GDGs CLIST & REXX 6
Search our Forums:

Back to Top