View previous topic :: View next topic
|
Author |
Message |
MARINA JOSEPH
New User
Joined: 11 Jun 2009 Posts: 61 Location: chennai
|
|
|
|
Hi,
I have written a MACRO which will be run against the COBOL program.
I need to add a line containing the value of SEE by calling ADD subroutine.
But it is appearing as SEE.
The value NEW is not reflecting.
Is there anything wrong in the syntax as it does not appear to enter into the condition IF SYSDSN ("'"FILEIN"'") = 'OK' THEN?
Code: |
/*REXX*/
FILEIN = G68462.BCPPOLFC
"ISREDIT MACRO"
/*CHECK IF THE LIBRARY EXISTS OR NOT*/
/*INVOKING ISPF FILE SERVICES*/
IF SYSDSN ("'"FILEIN"'") = 'OK' THEN
DO
"ALLOC DSN(G68462.BCPPOLFC)DD(INDSET)SHR REUSE"
"EXECIO * DISKR INDSET(STEM REC.)"
SEE = 'NEW'
J = 1
CTR = 0
IF REC.0 > 0 THEN
DO I = 1 TO REC.0
PARSE VAR REC.I WITH 7 COL7 +1 STRING 73
IF COL7 = '*' | COL7 = '-' | COL7 = '/' THEN
NOP
ELSE
DO
POS_WORD = FIND(STRING,'PIC')
IF POS_WORD <> 0 THEN
DO
SAY 'EXISTS'
FSTRING.J = WORD(STRING,POS_WORD-1)
CTR = CTR +1
DEFINED = YES
SAY FSTRING.J */
IF FSTRING.J <> "" THEN
J = J + 1
ELSE
NOP
END
ELSE
NOP
SAY 'NOT EXIST' */
END
END
SAY CTR
SAY FSTRING.1
IF DEFINED = YES THEN
DO
CALL ADD
END
/* ADD THE JCL STATEMENTS*/
ADD:
ADDRESS ISREDIT "(LASTLINE) = LINENUM .ZL"
POINTER = LASTLINE
REC.1 = "IF "||FSTRING.1||" = "||FSTRING.1||"";
REC.2 = "END "SEE""
REC.0 = 2;
DO J =1 TO REC.0
L2 = REC.J;
'ISREDIT LINE_AFTER (POINTER)= <1,(L2)>';
END;
ISREDIT "SAVE"
ISREDIT "SAVE"
EXIT |
|
|
Back to top |
|
|
prino
Senior Member
Joined: 07 Feb 2009 Posts: 1315 Location: Vilnius, Lithuania
|
|
|
|
Please put your code between
tags, the posting is too unreadable to do anything with it. Stripping trailing blanks from Cut&Paste'd data would also help... |
|
Back to top |
|
|
MARINA JOSEPH
New User
Joined: 11 Jun 2009 Posts: 61 Location: chennai
|
|
|
|
I hope this works.
Code: |
/*REXX*/
FILEIN = G68462.BCPPOLFC
"ISREDIT MACRO"
/*CHECK IF THE LIBRARY EXISTS OR NOT*/
/*INVOKING ISPF FILE SERVICES*/
IF SYSDSN ("'"FILEIN"'") = 'OK' THEN
DO
"ALLOC DSN(G68462.BCPPOLFC)DD(INDSET)SHR REUSE"
"EXECIO * DISKR INDSET(STEM REC.)"
SEE = 'NEW'
J = 1
CTR = 0
IF REC.0 > 0 THEN
DO I = 1 TO REC.0
PARSE VAR REC.I WITH 7 COL7 +1 STRING 73
IF COL7 = '*' | COL7 = '-' | COL7 = '/' THEN
NOP
ELSE
DO
POS_WORD = FIND(STRING,'PIC')
IF POS_WORD <> 0 THEN
DO
SAY 'EXISTS'
FSTRING.J = WORD(STRING,POS_WORD-1)
CTR = CTR +1
DEFINED = YES
/* SAY FSTRING.J */
IF FSTRING.J <> "" THEN
J = J + 1
ELSE
NOP
END
ELSE
NOP
/* SAY 'NOT EXIST' */
END
END
SAY CTR
SAY FSTRING.1
IF DEFINED = YES THEN
DO
CALL ADD
END
END
/* ADD THE JCL STATEMENTS*/
ADD:
ADDRESS ISREDIT "(LASTLINE) = LINENUM .ZL"
POINTER = LASTLINE
REC.1 = "IF "||FSTRING.1||" = "||FSTRING.1||"";
REC.2 = "END "SEE""
REC.0 = 2;
DO J =1 TO REC.0
L2 = REC.J;
'ISREDIT LINE_AFTER (POINTER)= <1,(L2)>';
END;
ISREDIT "SAVE"
ISREDIT "SAVE"
EXIT |
Edited: Please use BBcode when You post some code/error, that's rather readable, Thanks... Anuj |
|
Back to top |
|
|
prino
Senior Member
Joined: 07 Feb 2009 Posts: 1315 Location: Vilnius, Lithuania
|
|
|
|
Still cannot be bothered to use
tags?
Add 'trace ?r' after /* REXX */ and try finding out the problem yourself. |
|
Back to top |
|
|
expat
Global Moderator
Joined: 14 Mar 2007 Posts: 8796 Location: Welsh Wales
|
|
|
|
Have you ran the REXX using TRACE I or TRACE R |
|
Back to top |
|
|
MARINA JOSEPH
New User
Joined: 11 Jun 2009 Posts: 61 Location: chennai
|
|
|
|
Code: |
7 *-* "ISREDIT MACRO"
>>> "ISREDIT MACRO"
+++ RC(20) +++
9 *-* /*CHECK IF THE LIBRARY EXISTS OR NOT*/
10 *-* /*INVOKING ISPF FILE SERVICES*/
13 *-* IF SYSDSN ("'"FILEIN"'") = "OK"
>>> "0"
57 *-* /* ADD THE JCL STATEMENTS*/
58 *-* ADD: |
Above is the result of running TRACE.
Edited: Please use BBcode when You post some code/error, that's rather readable, Thanks... Anuj |
|
Back to top |
|
|
expat
Global Moderator
Joined: 14 Mar 2007 Posts: 8796 Location: Welsh Wales
|
|
|
|
How do you invoke the macro
MACRONAME
0r
TSO MACRONAME
or
TSO EXEC 'pds name(MACRONAME)' |
|
Back to top |
|
|
MARINA JOSEPH
New User
Joined: 11 Jun 2009 Posts: 61 Location: chennai
|
|
|
|
Invoke the MACRO by MACRONAME.
If i try giving the statement SEE ='NEW' outside the IF condition it works.
The value 'NEW' reflects. |
|
Back to top |
|
|
expat
Global Moderator
Joined: 14 Mar 2007 Posts: 8796 Location: Welsh Wales
|
|
|
|
Ok, I have spent a while tidying up your original post, and as Prino has said - use the code tags. Look at the difference between the tidied version and the raw version.
learn the tags, and use them !!!
It is obvious that the result from your SYSDSN is not "OK" as you want it to be.
I would use TRACE I - a bit cumbersome but more informative - to see what the return is and possibly why. |
|
Back to top |
|
|
expat
Global Moderator
Joined: 14 Mar 2007 Posts: 8796 Location: Welsh Wales
|
|
|
|
Having done a test or two, I suggest that you look at the syntax for SYSDSN and the examples shown in the manual, then you might get somewhere. |
|
Back to top |
|
|
MARINA JOSEPH
New User
Joined: 11 Jun 2009 Posts: 61 Location: chennai
|
|
|
|
Ok,
I have solved the error.
Now i need to pass the array FSTRING into the subroutine ADD.
I used the statement CALL ADD(FSTRING).
How do you pass the same? |
|
Back to top |
|
|
Anuj Dhawan
Superior Member
Joined: 22 Apr 2006 Posts: 6248 Location: Mumbai, India
|
|
|
|
Hello MARINA,
Are the messages from Robert (priso) not visible at your end? I've edited the "code" and "error" messages you post. Please use BBcode tags going forward. |
|
Back to top |
|
|
MARINA JOSEPH
New User
Joined: 11 Jun 2009 Posts: 61 Location: chennai
|
|
|
|
Going forward yes , i will use the tags.
But in my last post i did not post any code, just asked how to pass an array to a subroutine within a MACRO. |
|
Back to top |
|
|
expat
Global Moderator
Joined: 14 Mar 2007 Posts: 8796 Location: Welsh Wales
|
|
|
|
What have you tried, and what was the result |
|
Back to top |
|
|
MARINA JOSEPH
New User
Joined: 11 Jun 2009 Posts: 61 Location: chennai
|
|
|
|
I am not sure about the syntax to pass an array to an internal subroutine within a MACRO.
So if somebody could help me with the syntax...
I tried
CALL ADD(FSTRING.) within the calling routine.
ADD:
ARG FSTRING.
It throws error in the way i have used the CALL statement. |
|
Back to top |
|
|
expat
Global Moderator
Joined: 14 Mar 2007 Posts: 8796 Location: Welsh Wales
|
|
|
|
Why do you think that you need to pass the array to an internal subroutine.
Have you tried to simply use the array in the subroutine exactly as it is
How long would it have taken you to test this yourself
Code: |
/* REXX *** POSSIBLE TO PASS AN ARRAY TO AN INTERNAL ROUTINE */
A.1 = 'A'
A.2 = 'B'
A.3 = 'C'
A.4 = 'D'
A.5 = 'E'
A.0 = 5
SAY "START - - - MAIN ROUTINE"
DO AA = 1 TO A.0
SAY A.AA
END
SAY "END - - - - MAIN ROUTINE"
CALL SUBROUT
EXIT
/*-------------------------------------------------------------------*/
SUBROUT:
SAY "START - - - SUB ROUTINE"
DO AA = A.0 TO 1 BY -1
SAY A.AA
END
SAY "END - - - - SUB ROUTINE"
RETURN |
|
|
Back to top |
|
|
prino
Senior Member
Joined: 07 Feb 2009 Posts: 1315 Location: Vilnius, Lithuania
|
|
|
|
You cannot pass stems to subroutines. |
|
Back to top |
|
|
|