Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

How to copy contents of file where the command was issued?

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> TSO/ISPF
View previous topic :: :: View next topic  
Author Message
karthikr44

Active User


Joined: 25 Aug 2007
Posts: 235
Location: Chennai

PostPosted: Wed Aug 20, 2008 8:44 pm    Post subject: How to copy contents of file where the command was issued?
Reply with quote

HI,

I tried to copy all the contents of file where the command was issued using the following code.

Code:

/* REXX */                                             
ADDRESS ISREDIT MACRO                                 
"ISREDIT (DSNAME) = DATASET"                           
"ISREDIT (MEMNAME) = MEMBER"                           
DSN = DSNAME || "(" || MEMNAME || ")"                 
SAY DSN                                               
"ALLOC FI(DDJCL) DA('"DSN"') OLD"                     
"EXECIO * DISKR DDJCL (STEM JCLLINES. FINIS "         
                                                       


For example when i issue command SAMP i want to copy all the contents of file DEV2.RK.JCL(NWAVRW08) to array.

Code:

  File  Edit  Edit_Settings  Menu  Utilities  Compilers  Test  Help           
sssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssss
VIEW       DEV2.RK.JCL(NWAVRW08) - 01.00                   Columns 00001 00072
Command ===> SAMP                                                 Scroll ===> CSR 
****** ***************************** Top of Data ******************************
000001 //NWAVRW08 JOB (AOHW,4679),'THUR AGING RPT',CLASS=N,MSGCLASS=Q,         
000002 //         USER=OPSPROD                                                 
000003 //***************************************************************       
000004 //*        AVERSION THURSDAY AGING REPORT                       *       
000005 //* FREQUENCY:  THURSDAY NIGHT                                  *       
000006 //***************************************************************       
000007 //JSTP0010 EXEC DCAVRW08,                                               
000008 //         SCHEMA='USSSUP01',                                           
000009 //         LOADLIB='APPLLIB',                                           
000010 //         IDMSLIB='IDMSLIB',                                           
000011 //         SYSIDMS='NWPDICT',                                           


But it displays error message that
Code:

 IKJ56246I DATA SET DEV2.RK.JCL NOT ALLOCATED, FILE IN USE                     
 IRX0552E The input or output file DDJCL is associated with a partitioned data s
et. A member name must be specified.                                           
 IRX0670E EXECIO error while trying to GET or PUT a record.                     
 ***                                                                           
                                                                             


Please let me know how to do that?

Thanks in advance
R KARTHIK
Back to top
View user's profile Send private message

superk

Moderator Team Head


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

PostPosted: Wed Aug 20, 2008 8:47 pm    Post subject: Reply to: How to copy contents of file where the command wa
Reply with quote

I don't know how you can allocate a dataset that you currently have open and enqueued in an EDIT session with a disposition of OLD.
Back to top
View user's profile Send private message
enrico-sorichetti

Global Moderator


Joined: 14 Mar 2007
Posts: 10292
Location: italy

PostPosted: Wed Aug 20, 2008 8:53 pm    Post subject: Reply to: How to copy contents of file where the command wa
Reply with quote

this snippet will put in a stem variable all the lines of the thing being edited/viewed regardless of the organization

Code:
ISREDIT (first) = LINENUM .zfirst
ISREDIT (last) = LINENUM .zlast
i = 0
do linenum = first to last
    i = i + 1
    ISREDIT (temp) = LINE linenum
    line.i = temp
end
line.0 = i
Back to top
View user's profile Send private message
Pedro

Senior Member


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

PostPosted: Wed Aug 20, 2008 9:41 pm    Post subject: Reply to: How to copy contents of file where the command wa
Reply with quote

I think it would have worked with EXECIO, except that you probably had tried earlier versions of your rexx program. And you did not free DDJCL after previous attempts.

Based on the error messages, your most recent ALLOC did not work because you did not free it earlier. Or you can add REUSE to the ALLOC to use the same dd name.

Based on the error messages, the previous ALLOC did not specify a member name, so the subsequent EXECIO did not work.

And change OLD to SHR on your ALLOC statement.
Back to top
View user's profile Send private message
MBabu

Active User


Joined: 03 Aug 2008
Posts: 401
Location: Mumbai

PostPosted: Thu Aug 21, 2008 6:38 am    Post subject: Reply to: How to copy contents of file where the command wa
Reply with quote

Code:
/* REXX */                                                   
Address isredit
'MACRO'
'(fin) = linenum .zl'
stem.0=fin
Do a=1 to stem.0; '(C) = line 'a ; stem.a=strip(c,'T') ; End
Do a=1 to stem.0; Say stem.a;End

wasn't this question just asked a couple of days ago?
Back to top
View user's profile Send private message
karthikr44

Active User


Joined: 25 Aug 2007
Posts: 235
Location: Chennai

PostPosted: Thu Aug 21, 2008 4:43 pm    Post subject: Reply to: How to copy contents of file where the command wa
Reply with quote

HI,

Thanks for all replies.

Pedro:
Quote:

Or you can add REUSE to the ALLOC to use the same dd name.


It worked. And i tried enrico-sorichetti, MBabu code also.

Code:

ADDRESS ISREDIT MACRO   
"ISREDIT (FIRST) = LINENUM .ZFIRST"   
"ISREDIT (LAST) = LINENUM .ZLAST"     
I=0
DO LINENUM = FIRST TO LAST           
    I = I + 1                         
    SAY LINENUM                       
   "ISREDIT (TEMP) = LINE LINENUM"   
    LINE.I = TEMP                     
    SAY LINE.I                       
END                                   
LINE.0 = I                           


But it throws the following error

Code:

Command in error . : (TEMP) = LINE LINENUM                           
                                                                     
Invalid line pointer                                                 
LPTR not numeric or label in syntax "ISREDIT (varname) = LINE LPTR".


Kindly clarify...
Back to top
View user's profile Send private message
karthikr44

Active User


Joined: 25 Aug 2007
Posts: 235
Location: Chennai

PostPosted: Thu Aug 21, 2008 6:50 pm    Post subject: Reply to: How to copy contents of file where the command wa
Reply with quote

Hi,

I solved the problem by replacing
"ISREDIT (TEMP) = LINE LINENUM"
to
"ISREDIT (TEMP) = LINE &LINENUM"

Regards
R KARTHIK
Back to top
View user's profile Send private message
Pedro

Senior Member


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

PostPosted: Thu Aug 21, 2008 9:40 pm    Post subject: Reply to: How to copy contents of file where the command wa
Reply with quote

Its just me. I do not care for using the ampersands. It looks too much like clists. I always use rexx notation and it will resolve the variable before passing the entire command to ISPF.

Code:
"ISREDIT (TEMP) = LINE" LINENUM

That is, LINENUM should be outside of the character string.
Back to top
View user's profile Send private message
karthikr44

Active User


Joined: 25 Aug 2007
Posts: 235
Location: Chennai

PostPosted: Fri Aug 22, 2008 1:20 pm    Post subject: Reply to: How to copy contents of file where the command wa
Reply with quote

HI Pedro,

Thanks for sharing the concept.....

Regards
R KARTHIK
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> TSO/ISPF All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Match two files using multiple keys a... santoshks1987 SYNCSORT 10 Fri Aug 18, 2017 10:50 am
No new posts Command to find TMEMBER name for a TPIPE Siva NKK Kothamasu IMS DB/DC 0 Wed Aug 16, 2017 6:08 pm
No new posts Multiple VSAM files single output fil... Mohan Kothakota DFSORT/ICETOOL 11 Wed Aug 09, 2017 7:57 pm
This topic is locked: you cannot edit posts or make replies. rexx to create a tso command Bharath Vikraman CLIST & REXX 1 Tue Aug 08, 2017 3:32 pm
This topic is locked: you cannot edit posts or make replies. rexx code to create a ps file Bharath Vikraman CLIST & REXX 4 Mon Aug 07, 2017 10:30 am


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us