View previous topic :: View next topic |
Author |
Message |
arindam Beginner
Joined: 08 Jan 2003 Posts: 5 Topics: 1 Location: India, Kolkata
|
Posted: Wed Jan 15, 2003 7:12 am Post subject: How can I perform file handling inside an edit macro? |
|
|
My requirement is to put some message line at the top of a file when opened in EDIT mode. But, the message is decided at the run time and will come from another file. Now I am facing the problem while accessing the second file (containing message text) inside the MACRO, as EXECIO is not permitted inside the MACRO. Can anybody provide any solution regading this?
Thanks in advance. _________________ Thanks and Regards,
Arindam |
|
Back to top |
|
|
Manas Biswal Intermediate
Joined: 29 Nov 2002 Posts: 382 Topics: 27 Location: Chennai, India
|
Posted: Wed Jan 15, 2003 7:44 am Post subject: |
|
|
You can read the file in the driver REXX routine and write it to a stem variable or a stack and then use it in the edit macro.
Regards,
Manas |
|
Back to top |
|
|
arindam Beginner
Joined: 08 Jan 2003 Posts: 5 Topics: 1 Location: India, Kolkata
|
Posted: Wed Jan 15, 2003 7:53 am Post subject: |
|
|
Thanks for the input Manas. But I have already tried with the stem variable. What I did, I read the file before calling the macro. Now, you need to pass the data stored in the stem variable to the macro. How can you do that? One solution is put them into profile (using VPUT) and get them inside the macro (using VGET). But, the VPUT/VGET command doesn't work with compound variables and even you dont know how many lines you have to insert as the note.
I am not sure about STACK option. I have to check it out.
Anyway, thanks for your co-operation. _________________ Thanks and Regards,
Arindam |
|
Back to top |
|
|
DaveyC Moderator
Joined: 02 Dec 2002 Posts: 151 Topics: 3 Location: Perth, Western Australia
|
Posted: Wed Jan 15, 2003 8:06 am Post subject: |
|
|
I've never had a problem reading a file with EXECIO in an edit macro. Why don't you post your code or the error message you are gettting... _________________ Dave Crayford |
|
Back to top |
|
|
arindam Beginner
Joined: 08 Jan 2003 Posts: 5 Topics: 1 Location: India, Kolkata
|
Posted: Wed Jan 15, 2003 8:16 am Post subject: |
|
|
In fact I was amused too. It was a silly thing that was missing in my macro. Before "ADDRESS ISREDIT" I had to include "ADDRESS TSO" for the EXECIO operation. Grrrrrrrr. _________________ Thanks and Regards,
Arindam |
|
Back to top |
|
|
Mike Beginner
Joined: 03 Dec 2002 Posts: 114 Topics: 0 Location: Sydney, Australia
|
Posted: Wed Jan 15, 2003 6:24 pm Post subject: |
|
|
Arindam,
the following is code that could be used to place STEM variables into ISPF variables. Where n is an arbritary number an IN.n is the populated STEM variable then.
Code: |
LCNT = n
VPUTVARS = "LCNT "
Do i = 1 to n
VNAME = "L"||Right(i,8,'0')
Interpret VNAME" = "IN.i
VPUTVARS = VPUTVARS||VNAME||" "
End
"VPUT ("VPUTVARS "VPUTVARS) SHARED"
|
Say n = 3 then you will have stem variables IN.1, IN.2 & IN.3
The above code will generate variables L0000001, L0000002 & L0000003 (with values as per IN.1, IN.2 & IN.3 respectively)
the variable VPUTVARS will end up with the value
LCNT L0000001 L0000002 L0000003
i.e. the list of variable names (including the number of stem variables, as held in LNCT)
The last line, that does the VPUT will equate to :-
VPUT (LCNT L0000001 L0000002 L0000003 VPUTVARS) SHARED
(putting VPUTVARS, the list of variables put into the pool simplefies the VGETS when retrieving the variables e.g.
"VGET(VPUTVARS) SHARED"
"VGET("VPUTVARS") SHARED"
Using LCNT you could rebuild the stem variables if required.
Note This obviously only works if the tail of the stem variable is a numeric, also there are restrictions on how many variables can be handled in this fashion.
Note I haven't actually checked the above code, just typed it in, so there's probably some stupid little errors. _________________ Regards,
Mike. |
|
Back to top |
|
|
|
|