| IBM MAINFRAME HELP & SUPPORT FORUMS Technical Forums for IBM Mainframe Applications like COBOL, JCL, CICS, DB2, FileAid, DFSORT, Endevor, Xpediter, CoolGen, CA-7&11, AbendAid, IMS, IDMS, PL/I, MqSeries, SyncSort, Assembler, ChangeMan, Easytrieve, InterTest, REXX, CLIST etc...
|
| View previous topic :: View next topic |
| Author |
Message |
karthikr44
Joined: 25 Aug 2007
Posts: 167
Location: Chennai
|
| Posted: Wed Aug 20, 2008 8:44 pm Post subject: How to copy contents of file where the command was issued? |
|
|
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 |
|
superk
Joined: 26 Apr 2004
Posts: 3260
Location: Charlotte,NC USA
|
| Posted: Wed Aug 20, 2008 8:47 pm Post subject: Reply to: How to copy contents of file where the command wa |
|
|
| 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 |
|
enrico-sorichetti
Joined: 14 Mar 2007
Posts: 3046
Location: italy
|
| Posted: Wed Aug 20, 2008 8:53 pm Post subject: Reply to: How to copy contents of file where the command wa |
|
|
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 |
|
Pedro
Joined: 01 Sep 2006
Posts: 502
Location: work
|
| Posted: Wed Aug 20, 2008 9:41 pm Post subject: Reply to: How to copy contents of file where the command wa |
|
|
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 |
|
MBabu
Joined: 03 Aug 2008
Posts: 31
Location: Mumbai
|
| Posted: Thu Aug 21, 2008 6:38 am Post subject: Reply to: How to copy contents of file where the command wa |
|
|
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 |
|
karthikr44
Joined: 25 Aug 2007
Posts: 167
Location: Chennai
|
| Posted: Thu Aug 21, 2008 4:43 pm Post subject: Reply to: How to copy contents of file where the command wa |
|
|
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 |
|
karthikr44
Joined: 25 Aug 2007
Posts: 167
Location: Chennai
|
| Posted: Thu Aug 21, 2008 6:50 pm Post subject: Reply to: How to copy contents of file where the command wa |
|
|
Hi,
I solved the problem by replacing
"ISREDIT (TEMP) = LINE LINENUM"
to
"ISREDIT (TEMP) = LINE &LINENUM"
Regards
R KARTHIK |
|
| Back to top |
|
Pedro
Joined: 01 Sep 2006
Posts: 502
Location: work
|
| Posted: Thu Aug 21, 2008 9:40 pm Post subject: Reply to: How to copy contents of file where the command wa |
|
|
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 |
|
karthikr44
Joined: 25 Aug 2007
Posts: 167
Location: Chennai
|
| Posted: Fri Aug 22, 2008 1:20 pm Post subject: Reply to: How to copy contents of file where the command wa |
|
|
HI Pedro,
Thanks for sharing the concept.....
Regards
R KARTHIK |
|
| Back to top |
|
| |
THIS IS AN ARCIVE FORUM IN READ ONLY MODE. IF YOU WANT TO ASK YOUR DOUBTS USE THE ACTUAL FORUM
|