you need to place the variable search strings in parens
parse var str temp1 (startMark) varname (endMark) temp2
Den 28-01-2018 kl. 00:34 skrev Rick McGuire:
you need to place the variable search strings in parens
parse var str temp1 (startMark) varname (endMark) temp2
Thank you very much Rick McGuire.
Your reply helped me finding the documentation about it: "9.4. Parsing
with Variable Patterns" in the Reference.
Here you see my code (without error handling, etc.):
substitute: procedure expose S.
arg lin
startMark = '<'
endMark = '>'
do while lin~pos(startMark) > 0
parse var lin temp1 (startMark) varname (endMark) temp2
lin = temp1 || S.varname || temp2
end
return lin
On 1/28/2018 3:18 AM, Jesper K Brogaard wrote:
Den 28-01-2018 kl. 00:34 skrev Rick McGuire:I'd like to see a snippet of code that uses this subroutine.
you need to place the variable search strings in parens
parse var str temp1 (startMark) varname (endMark) temp2
Thank you very much Rick McGuire.
Your reply helped me finding the documentation about it: "9.4. Parsing
with Variable Patterns" in the Reference.
Here you see my code (without error handling, etc.):
substitute: procedure expose S.
arg lin
startMark = '<'
endMark = '>'
do while lin~pos(startMark) > 0
parse var lin temp1 (startMark) varname (endMark) temp2
lin = temp1 || S.varname || temp2
end
return lin
Den 28-01-2018 kl. 23:32 skrev LesK:
On 1/28/2018 3:18 AM, Jesper K Brogaard wrote:
Den 28-01-2018 kl. 00:34 skrev Rick McGuire:I'd like to see a snippet of code that uses this subroutine.
you need to place the variable search strings in parens
  parse var str temp1 (startMark) varname (endMark) temp2
Thank you very much Rick McGuire.
Your reply helped me finding the documentation about it: "9.4.
Parsing with Variable Patterns" in the Reference.
Here you see my code (without error handling, etc.):
substitute: procedure expose S.
            arg lin
    startMark = '<'
    endMark  = '>'
    do while lin~pos(startMark) > 0
        parse var lin temp1 (startMark) varname (endMark) temp2
        lin = temp1 || S.varname || temp2
    end
    return lin
Of course you can:
S. = '???????'
S.zuser = 'XYZ' -- userid()~upper
S.project = 'PROJ123'
S.delta = 'SUBDIR'
S.class = 'A'
S.msgclass = 'B'
input = .stream~new('skeleton.jcl')
input~open('read')
output = .stream~new('new.jcl')
output~open('write replace')
do while input~lines <> 0
lineFromInput = input~linein()
newLine = substitute(lineFromInput)
output~lineout(newLine)
-- or in one line: output~lineout(substitute(input~linein()))
end
input~close()
output~close()
exit(0)
'skeleton.jcl' contains lines like these
//<ZUSER>DENV JOB (XF02-00R),'ALLOC <DELTA>',MSGLEVEL=(1,1), // CLASS=<CLASS>,MSGCLASS=<MSGCLASS>,
// REGION=4096K,NOTIFY=<ZUSER>
....
//CICSLOAD DD DSN=PN00.<PROJECT>.<DELTA>.CICSLOAD,
....
which will these lines after having been modified by the subroutine
//XYZDENV JOB (XF02-00R),'ALLOC SUBDIR',MSGLEVEL=(1,1),
// CLASS=A,MSGCLASS=B,
// REGION=4096K,NOTIFY=XYZ
....
//CICSLOAD DD DSN=PN00.PROJ123.SUBDIR.CICSLOAD,
....
On 1/28/2018 6:32 PM, Jesper K Brogaard wrote:
Den 28-01-2018 kl. 23:32 skrev LesK:Thanks. Very interesting.
On 1/28/2018 3:18 AM, Jesper K Brogaard wrote:
Den 28-01-2018 kl. 00:34 skrev Rick McGuire:I'd like to see a snippet of code that uses this subroutine.
you need to place the variable search strings in parens
  parse var str temp1 (startMark) varname (endMark) temp2
Thank you very much Rick McGuire.
Your reply helped me finding the documentation about it: "9.4. Parsing with
Variable Patterns" in the Reference.
Here you see my code (without error handling, etc.):
substitute: procedure expose S.
            arg lin
    startMark = '<'
    endMark  = '>'
    do while lin~pos(startMark) > 0
        parse var lin temp1 (startMark) varname (endMark) temp2
        lin = temp1 || S.varname || temp2
    end
    return lin
Of course you can:
S. = '???????'
S.zuser = 'XYZ' -- userid()~upper
S.project = 'PROJ123'
S.delta = 'SUBDIR'
S.class = 'A'
S.msgclass = 'B'
input = .stream~new('skeleton.jcl')
input~open('read')
output = .stream~new('new.jcl')
output~open('write replace')
do while input~lines <> 0
lineFromInput = input~linein()
newLine = substitute(lineFromInput)
output~lineout(newLine)
-- or in one line: output~lineout(substitute(input~linein()))
end
input~close()
output~close()
exit(0)
'skeleton.jcl' contains lines like these
//<ZUSER>DENV JOB (XF02-00R),'ALLOC <DELTA>',MSGLEVEL=(1,1),
// CLASS=<CLASS>,MSGCLASS=<MSGCLASS>,
// REGION=4096K,NOTIFY=<ZUSER>
....
//CICSLOAD DD DSN=PN00.<PROJECT>.<DELTA>.CICSLOAD,
....
which will these lines after having been modified by the subroutine
//XYZDENV JOB (XF02-00R),'ALLOC SUBDIR',MSGLEVEL=(1,1),
// CLASS=A,MSGCLASS=B,
// REGION=4096K,NOTIFY=XYZ
....
//CICSLOAD DD DSN=PN00.PROJ123.SUBDIR.CICSLOAD,
....
Btw: ooRexx 5.0.0 adds a new directive ::RESOURCE which allows you to include things like your skeleton in your code.
If you want a similar facility with Classic Rexx on ZOS, see Frank Clarke's presentation "Embedding Assets in REXX code" at the 2013 Rexx Symposium:
http://www.rexxla.org/events/2013/schedule.html
On 2018-01-29 07:48, LesK wrote:
On 1/28/2018 6:32 PM, Jesper K Brogaard wrote:
Den 28-01-2018 kl. 23:32 skrev LesK:Thanks. Very interesting.
On 1/28/2018 3:18 AM, Jesper K Brogaard wrote:
Den 28-01-2018 kl. 00:34 skrev Rick McGuire:I'd like to see a snippet of code that uses this subroutine.
you need to place the variable search strings in parens
  parse var str temp1 (startMark) varname (endMark) temp2
Thank you very much Rick McGuire.
Your reply helped me finding the documentation about it: "9.4.
Parsing with Variable Patterns" in the Reference.
Here you see my code (without error handling, etc.):
substitute: procedure expose S.
            arg lin
    startMark = '<'
    endMark  = '>'
    do while lin~pos(startMark) > 0
        parse var lin temp1 (startMark) varname (endMark)
temp2
        lin = temp1 || S.varname || temp2
    end
    return lin
Of course you can:
S. = '???????'
S.zuser = 'XYZ' -- userid()~upper
S.project = 'PROJ123'
S.delta = 'SUBDIR'
S.class = 'A'
S.msgclass = 'B'
input = .stream~new('skeleton.jcl')
input~open('read')
output = .stream~new('new.jcl')
output~open('write replace')
do while input~lines <> 0
lineFromInput = input~linein()
newLine = substitute(lineFromInput)
output~lineout(newLine)
-- or in one line: output~lineout(substitute(input~linein()))
end
input~close()
output~close()
exit(0)
'skeleton.jcl' contains lines like these
//<ZUSER>DENV JOB (XF02-00R),'ALLOC <DELTA>',MSGLEVEL=(1,1),
// CLASS=<CLASS>,MSGCLASS=<MSGCLASS>,
// REGION=4096K,NOTIFY=<ZUSER>
....
//CICSLOAD DD DSN=PN00.<PROJECT>.<DELTA>.CICSLOAD,
....
which will these lines after having been modified by the subroutine
//XYZDENV JOB (XF02-00R),'ALLOC SUBDIR',MSGLEVEL=(1,1),
// CLASS=A,MSGCLASS=B,
// REGION=4096K,NOTIFY=XYZ
....
//CICSLOAD DD DSN=PN00.PROJ123.SUBDIR.CICSLOAD,
....
Btw: ooRexx 5.0.0 adds a new directive ::RESOURCE which allows you to
include things like your skeleton in your code.
If you want a similar facility with Classic Rexx on ZOS, see Frank
Clarke's presentation "Embedding Assets in REXX code" at the 2013
Rexx Symposium:
http://www.rexxla.org/events/2013/schedule.html
Or you can use the method I'm using in
<https://prino.neocities.org/zOS/e123.exec.html>
using (auto-)generated queue statements (a method that can even be used
to embed load libraries inside an EXEC) using
<https://prino.neocities.org/zOS/epanq.exec.html>
Robert
On 1/28/2018 6:32 PM, Jesper K Brogaard wrote:
Den 28-01-2018 kl. 23:32 skrev LesK:Thanks. Very interesting.
On 1/28/2018 3:18 AM, Jesper K Brogaard wrote:
Den 28-01-2018 kl. 00:34 skrev Rick McGuire:I'd like to see a snippet of code that uses this subroutine.
you need to place the variable search strings in parens
  parse var str temp1 (startMark) varname (endMark) temp2
Thank you very much Rick McGuire.
Your reply helped me finding the documentation about it: "9.4.
Parsing with Variable Patterns" in the Reference.
Here you see my code (without error handling, etc.):
substitute: procedure expose S.
            arg lin
    startMark = '<'
    endMark  = '>'
    do while lin~pos(startMark) > 0
        parse var lin temp1 (startMark) varname (endMark)
temp2
        lin = temp1 || S.varname || temp2
    end
    return lin
Of course you can:
S. = '???????'
S.zuser = 'XYZ' -- userid()~upper
S.project = 'PROJ123'
S.delta = 'SUBDIR'
S.class = 'A'
S.msgclass = 'B'
input = .stream~new('skeleton.jcl')
input~open('read')
output = .stream~new('new.jcl')
output~open('write replace')
do while input~lines <> 0
lineFromInput = input~linein()
newLine = substitute(lineFromInput)
output~lineout(newLine)
-- or in one line: output~lineout(substitute(input~linein()))
end
input~close()
output~close()
exit(0)
'skeleton.jcl' contains lines like these
//<ZUSER>DENV JOB (XF02-00R),'ALLOC <DELTA>',MSGLEVEL=(1,1),
// CLASS=<CLASS>,MSGCLASS=<MSGCLASS>,
// REGION=4096K,NOTIFY=<ZUSER>
....
//CICSLOAD DD DSN=PN00.<PROJECT>.<DELTA>.CICSLOAD,
....
which will these lines after having been modified by the subroutine
//XYZDENV JOB (XF02-00R),'ALLOC SUBDIR',MSGLEVEL=(1,1),
// CLASS=A,MSGCLASS=B,
// REGION=4096K,NOTIFY=XYZ
....
//CICSLOAD DD DSN=PN00.PROJ123.SUBDIR.CICSLOAD,
....
Btw: ooRexx 5.0.0 adds a new directive ::RESOURCE which allows you to include things like your skeleton in your code.
If you want a similar facility with Classic Rexx on ZOS, see Frank
Clarke's presentation "Embedding Assets in REXX code" at the 2013 Rexx Symposium:
http://www.rexxla.org/events/2013/schedule.html
Note that ooRexx incubator has a simple template class that replaces variables of the form $(...)
See https://sourceforge.net/p/oorexx/code-0/HEAD/tree/incubator/texttemplate/
Sysop: | Keyop |
---|---|
Location: | Huddersfield, West Yorkshire, UK |
Users: | 430 |
Nodes: | 16 (2 / 14) |
Uptime: | 125:01:24 |
Calls: | 9,060 |
Calls today: | 7 |
Files: | 13,398 |
Messages: | 6,017,441 |
Posted today: | 1 |