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

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


IBM Mainframe Forums -> TSO/ISPF
Post new topic   Reply to topic
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
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

Global Moderator


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

PostPosted: Wed Aug 20, 2008 8:47 pm
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

Superior Member


Joined: 14 Mar 2007
Posts: 10873
Location: italy

PostPosted: Wed Aug 20, 2008 8:53 pm
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

Global Moderator


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

PostPosted: Wed Aug 20, 2008 9:41 pm
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: 400
Location: Mumbai

PostPosted: Thu Aug 21, 2008 6:38 am
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
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
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

Global Moderator


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

PostPosted: Thu Aug 21, 2008 9:40 pm
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
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 View Bookmarks
All times are GMT + 6 Hours
Forum Index -> TSO/ISPF

 


Similar Topics
Topic Forum Replies
No new posts Compare 2 files and retrive records f... DFSORT/ICETOOL 3
No new posts FTP VB File from Mainframe retaining ... JCL & VSAM 8
No new posts Extract the file name from another fi... DFSORT/ICETOOL 6
No new posts How to split large record length file... DFSORT/ICETOOL 10
No new posts RACF - Rebuild SETROPTS command which... All Other Mainframe Topics 3
Search our Forums:

Back to Top