MVSFORUMS.com Forum Index MVSFORUMS.com
A Community of and for MVS Professionals
 
 FAQFAQ   SearchSearch   Quick Manuals   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Need Help for REXX code

 
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> TSO and ISPF
View previous topic :: View next topic  
Author Message
ksandy
Beginner


Joined: 27 Mar 2003
Posts: 18
Topics: 11

PostPosted: Mon Oct 27, 2003 11:49 pm    Post subject: Need Help for REXX code Reply with quote

I am running a FOCUS report through REXX.

REXX is supposed to execute FOCUS report online rather than batch.

My code is

"Alloc DD(ER ) DS('dsname' ) SHR REU"
"Alloc DD(ER2 ) DS('dsname' ) SHR REU"
-
-
-

"Alloc DD(QQREPQQ) DS ('report dsname') SHR REU"

this is giving me FOCUS047 error , which says useid doesnt have
authority to access ER dataset and should use SET PASS command.

If I do this in batch , I am giving following REXX
statements to generate my batch JCL

Call Wj("//"QQREPQQ DD *")
Call Wj("SET PASS="USERID()")
Call Wj ("// DD DISP=SHR , DSN="ReprotDSN")

which in turn generating following JCL DD statements

//QQREPQQ DD *
SET PASS=myuserid
// DD DISP=SHR,DSN=reportDSN

Can anybody help me how to acheive above using Alloc statements or with any other way for getting my report displayed ONLINE .

Do CONCAT would help ? Please elaborate your suggestions/comments
fine

Thanks
Ksandy
Back to top
View user's profile Send private message
Mike
Beginner


Joined: 03 Dec 2002
Posts: 114
Topics: 0
Location: Sydney, Australia

PostPosted: Tue Oct 28, 2003 4:11 pm    Post subject: Reply with quote

It looks, not that I have used focus, that you need to have the record with SET PASS=myuserid included in the data that will read via DDNAME QQREPQQ

so perhaps something like this might work :-

Code:

/* Rexx - PROB0028                                                    */
  rptdsn = "DMI021.FOCUSPW.RPT"             /*--- used for testing ---*/
  myidds = userid()".FOCUSPW.T"time("S")                               
  pwstmnt.1 = Left("SET PASS="userid(),80)                             
  x = outtrap(x.,"*")                                                   
  "DELETE '"myidds"'"                                                   
  "ALLOC F(MYPW) DA('"myidds"') RECFM(F B) SPACE(1,1) CYL LRECL(80) ", 
    " NEW CATALOG"                                                     
  "EXECIO 1 DISKW MYPW (STEM pwstmnt. FINIS"                           
  "FREE F(MYPW)"                                                       
  x = outtrap("OFF")                                                   
  /*------------------------------------------------------------------*/
  /* the rest of your allocations etc go here, obviously not as       */
  /* comments, here's QQREPQQ                                         */
  /*------------------------------------------------------------------*/
  "ALLOC F(QQREPQQ) DA('"myidds"','"rptdsn"') SHR REUSE"               
  /* invoke focus etc here then when done free the allocations        */
  "FREE F(QQREPQQ)"                                                     
  /*------------------------------------------------------------------*/
  /* Then you may wish to delete the the dataset                      */
  /*------------------------------------------------------------------*/
  x = outtrap(x.,"*")                                                   
  "DELETE '"myidds"'"                                                   
  x = outtrap("OFF")                                                   


I've included a few comments that might assist.
Basically it generates a dataset name, that includes userid of the person running it as the HLQ, FOCUSPW as the 2nd qualifier and Tnnnnn as the third qualifier (where nnnnn is the number of seconds since midnight, thus generating a relatively unique dataset name).

Next an attempt is made to delete the dataset (this should not exist, but hust in case).

This dataset is then created and allocated to the ddname MYPW (you might have to play around with the alloc statement, depending upon how your site is setup and the requirements of the FOCUS QQREPQQ ddname (I'm pretty sure a record length of 80 will be OK though).

A single record is written (this being generated previously and stored in the variable PWSTMNT.1) via the EXECIO statement.

The dataset is then FREED from the ddname MYPW.

The dataset, that now contains the appropriate data (I hope), and the report dataset name (note I've used a test dataset, it's name being held in the rptdsn variable and set in the 3rd statement). They are concatenated in the correct order (i.e. the dataset with the SET PASS=??? statement being processed first).

You would then do you other allocations and then invoke FOCUS.

After the report has been run, it would be prudent to free all the ddnames (I've show 1 statement freeing the datasets allocated to ddname QQREPQQ ).

It would also be prudent to then delete the dataset containing the SET PASS=??? statement. Again I have included this.

You will notice two pairs of Outtrap statements, these are used to suppress the messages that you probbaly wouldn't want the user to see.

I hope this helps you to resolve your problem.
_________________
Regards,
Mike.
Back to top
View user's profile Send private message
ksandy
Beginner


Joined: 27 Mar 2003
Posts: 18
Topics: 11

PostPosted: Thu Oct 30, 2003 11:45 pm    Post subject: Reply with quote

Hi Mike

Sorry for late reply..

1. thanks for your help ..here is what I found another way of doing the same
===========================
Instead of
//REPDD DD *
SET Pass=userid
// DD dsnname
//SYSIN DD *
EX REPDD
/*

have decided
//REPDD DD dsnname
//SYSIN DD *
SET Pass=userid
EX REPDD

so after my "Alloc DD(SYSIN) DS(*)" stmt , have included

Queue 'SET PASS='Userid()
Do Queued(); pull;End

It worked perfectly
==========================


2. I have another problem now ...

I have FOCUS reports stored in various members of PDS.
I want to
a. Read a requested report DYNAMICALLY ( xyz.aaa.bbb(test) )
b. Store it in some intermediate place like Queue or something else
c. Read the QUEUE one by one and include that report in
SYSIN DD * statement of enclosed JCL which will get submitted ultimately
d. Check if you get a statement named END
e. Just before that statement , I want to include another FOCUS command
ON TABLE SAVE AS 'userprovided name'

f. Write END statement as it is after that

g. As informed earlier , include modified report as SYSIN DD * or with any other DDNAME say
//REPORT1 DD *
modified report


Here is what I thought as of NOW
Address TSO "Alloc DD(ddname) DS(dsname) SHR REUSE"
Address TSO "EXECIO * DISK SYSIN (FINIS"
Do Queued(); pull ; End

This will put in a Queue . Now I wanted to read that Queue and search for END statement....

Let me know comments/suggestions
Back to top
View user's profile Send private message
Mike
Beginner


Joined: 03 Dec 2002
Posts: 114
Topics: 0
Location: Sydney, Australia

PostPosted: Sun Nov 02, 2003 5:23 pm    Post subject: Reply with quote

Personally, if I understand your question correctly, I'd do something like this (note I prefer reading/writing from stem variables rather than using the stack (not sure if there's really any real advantage/disadvantage with either method), so I am more comfortable providing examples that utilise them):-

[code:1:b264a9dd3c]
ADDRESS TSO
/* Allocate file to be read */
"ALLOC DD(SYSIN) DS(dsname) SHR REUSE"
/* Allocate file for job submission */
ADDRESS TSO "ALLOC F(INTRDR) RECFM(F) LRECL(80) SYSOUT(A) ",
"WRITER(INTRDR)"

/* Loop through the input writing each record to the internal reader */
/* If a record contains an END STATEMENT (END with space either side) Then add a record prior to the END statement */
Do Forever
"EXECIO 1 DISKR SYSIN (STEM in. "
If Rc
_________________
Regards,
Mike.
Back to top
View user's profile Send private message
ksandy
Beginner


Joined: 27 Mar 2003
Posts: 18
Topics: 11

PostPosted: Mon Nov 03, 2003 11:47 pm    Post subject: Reply with quote

Thanks a lot Mike ...that really helped me a lot.

Here is another stuff am looking at.

1.I have one memeber corresponding to each year in one of my PDS
PDS(mem99) (mem02) etc which contains DB files in the format
e.g HLQ..&DB..abc.xyz

2. I would like to read specific memeber and replace the symbolic parameter and include modified statements in my dynamically generated JCL

Any guess ?

I hope I should go in same line of reading PDS memeber into STEM variable. But what about replacing symbolic variables?


Thanks
Ksandy
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12376
Topics: 75
Location: San Jose

PostPosted: Tue Nov 04, 2003 6:24 am    Post subject: Reply with quote

ksandy,


If your shop has file-aid then it is very easy to replace a string.Here is a rexx a solution which ofer posted just today in another thread.

http://www.mvsforums.com/helpboards/viewtopic.php?t=1388

Hope this helps....

cheers

kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> TSO and ISPF All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


MVSFORUMS
Powered by phpBB © 2001, 2005 phpBB Group