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

Append records in a PDS member after running a CLIST command


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

New User


Joined: 22 Mar 2007
Posts: 57
Location: India

PostPosted: Wed Dec 03, 2008 3:26 pm
Reply with quote

Requirement is -
After a particular CLIST command is executed a PDS member (member name = userid) should be updated by certain information.

My CLIST command is for opening a given member existing in a PDS (specified in command).

I had tried with the following Code:
Code:

PROC 1 MBR                                                             
/**********************************************************************/
/*                            REXX                                    */
/**********************************************************************/
IF &SYSDSN('DE00.T0000000.ECMS.CPY(&MBR)') = OK +                       
   THEN ISPEXEC VIEW DATASET('DE00.T0000000.ECMS.CPY(&MBR)')           
ELSE WRITE COMPONENT DOES NOT EXIST - &MBR                             
END                                                                     
user = userid()                                                         
MYDSN = "'DE00.THTSUTIL.ECMS.IDS("user")'"                             
"ALLOC DD(PDSID) DA("MYDSN") SHR"                                       
Queue 'line1 : Should be written in member ' user on date()             
Queue 'line2 : Should be written in member ' user at time()             
"EXECIO "Queued()" DISKW PDSID (FINIS"                                 
"FREE DD(PDSID)"                                                       
exit                                                                   


The above code is not giving any error and opens member DE00.T0000000.ECMS.CPY(MEMBER), when TSO <CLIST Command name> MEMBER is entered in command line.
But it do not write records in the PDS(DE00.THTSUTIL.ECMS.IDS) with member name = Userid of the person executing the CLIST command.

The logic of writing member in PDS DE00.THTSUTIL.ECMS.IDS works fine when executed separately without logic of opening member in PDS DE00.T0000000.ECMS.CPY
Back to top
View user's profile Send private message
Pedro

Global Moderator


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

PostPosted: Wed Dec 03, 2008 10:18 pm
Reply with quote

CLIST and rexx are two separate languages. You are mixing CLIST statements with REXX statements. If you are writing something new, you should use REXX only.
Back to top
View user's profile Send private message
Deepakgoyal2005

New User


Joined: 22 Mar 2007
Posts: 57
Location: India

PostPosted: Thu Dec 04, 2008 3:15 pm
Reply with quote

Can anyone suggest for what are the required changes in the above code to change entirely to REXX or CLIST and solve the purpose.
Back to top
View user's profile Send private message
superk

Global Moderator


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

PostPosted: Thu Dec 04, 2008 6:15 pm
Reply with quote

Let's see if I understand the process.

The user enters the TSO/E command "TSO execname MEMBER".

The exec should check for the existence of the dataset:

'DE00.T0000000.ECMS.CPY(MEMBER)'

and if OK then it should open it for a BROWSE session, otherwise a message should be displayed to the user and the exec should exit.

After the user ends the BROWSE session, another library:

''DE00.THTSUTIL.ECMS.IDS("userid")' is allocated and two lines are written to that member:

'line1 : Should be written in member 'userid' on 'date()
'line2 : Should be written in member 'userid' at 'time()

Is it just those two lines written every time, or do we need to add logic to first read any existing lines, then add two new ones to the (bottom or top)?
Back to top
View user's profile Send private message
Deepakgoyal2005

New User


Joined: 22 Mar 2007
Posts: 57
Location: India

PostPosted: Thu Dec 04, 2008 6:53 pm
Reply with quote

Your understanding is absolutely correct Superk.
We need to add logic to first read any existing lines, then add two new ones to the bottom.
Back to top
View user's profile Send private message
Marso

REXX Moderator


Joined: 13 Mar 2006
Posts: 1353
Location: Israel

PostPosted: Thu Dec 04, 2008 10:32 pm
Reply with quote

Snipped from TSO/E REXX Reference (In EXECIO paragraph):
Quote:
To append information to a member of a PDS, rewrite the member with the additional records added.
Back to top
View user's profile Send private message
superk

Global Moderator


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

PostPosted: Fri Dec 05, 2008 2:20 am
Reply with quote

Try this:
Code:

/**********************************************************************/
/*                            REXX                                    */
/**********************************************************************/
Parse Arg member
If SYSDSN("'DE00.T0000000.ECMS.CPY("member")'") = "OK" Then
  ISPEXEC VIEW DATASET('DE00.T0000000.ECMS.CPY("member")')           
Else
  Do
    Say "COMPONENT DOES NOT EXIST - "member
    Exit
  End
user = Userid()
mydsn = "''DE00.THTSUTIL.ECMS.IDS("user")'"
"ALLOC DD(PDSID) DA("mydsn") SHR REUSE"
If SYSDSN(mydsn) = "OK" Then "EXECIO * DISKR PDSID (FINIS"
Queue 'line1 : Should be written in member 'user' on 'date()             
Queue 'line2 : Should be written in member 'user' at 'time()             
"EXECIO "Queued()" DISKW PDSID (FINIS"                                 
"FREE DD(PDSID)"                                                       
exit                                                                   
Back to top
View user's profile Send private message
Deepakgoyal2005

New User


Joined: 22 Mar 2007
Posts: 57
Location: India

PostPosted: Fri Dec 05, 2008 12:38 pm
Reply with quote

It worked as required with only small change in syntax -

Working Code -
Code:

/*                            REXX                                    */
/**********************************************************************/
Parse Arg member                                                       
If SYSDSN("'DE00.T0000000.ECMS.CPY("member")'") = "OK" Then             
 "ISPEXEC VIEW DATASET('DE00.T0000000.ECMS.CPY("member")')"             
Else                                                                   
  Do                                                                   
    Say "COMPONENT DOES NOT EXIST - " member                           
    Exit                                                               
  End                                                                   
user = Userid()                                                         
mydsn = "'DE00.THTSUTIL.ECMS.IDS("user")'"                             
"ALLOC DD(PDSID) DA("mydsn") SHR REUSE"                                 
If SYSDSN(mydsn) = "OK" Then "EXECIO * DISKR PDSID (FINIS"             
Queue 'line1 : Should be written in member 'user' on 'date()           
Queue 'line2 : Should be written in member 'user' at 'time()           
"EXECIO "Queued()" DISKW PDSID (FINIS"                                 
"FREE DD(PDSID)"                                                       
exit                                                                   


Thanks Superk for your valuable inputs.
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 RACF - Rebuild SETROPTS command which... All Other Mainframe Topics 3
No new posts Running REXX through JOB CLIST & REXX 13
No new posts Routing command Address SDSF to other... TSO/ISPF 2
No new posts Compare only first records of the fil... SYNCSORT 7
No new posts Pulling a fixed number of records fro... DB2 2
Search our Forums:

Back to Top