The valid syntax for %%SET in MFBSI is:
%%SET %%VarName[space(s)]=[space(s)]Expression
Expression can be:
This example shows %%SET variable substitution:
Statement/Expression | Resolves as... |
---|---|
%%SET %%PARM=XYZ |
%%PARM: [XYZ] |
%%SET %%PARM =XYZ |
%%PARM: [XYZ] |
%%SET %%PARM = XYZ |
%%PARM: [XYZ] |
%%SET %%PARM = X Y Z |
%%PARM: [XYZ] |
%%SET %%PARM=ABC DEF |
%%PARM: [ABCDEF] |
%%SET %%PARM=ABC%%BLANK2DEF |
%%PARM: [ABC DEF] |
%%SET %%PARM=ABC%%BLANKDEF |
%%PARM: [ABC DEF] |
%%SET %%PARM=ABCDEF%%BLANK5 |
%%PARM: [ABCDEF ] |
%%SET %%PARM=ABCDEF%%BLANK3 |
%%PARM: [ABCDEF ] |
%%SET %%PARM='ABCDEF%%BLANK5' |
%%PARM: ['ABCDEF '] |
%%SET %%PARM=%%$ODATE%%.ABC |
%%PARM: [20110701ABC] |
%%SET %%PARM=%%$ODATE.ABC |
%%PARM: [20110701.ABC] |
%%SET %%PARM=%%$ODATEABC |
Error: %%$ODATEABC can't be resolved. |
%%SET %%A=1 %%SET %%B=2 %%SET %%A2=100 // TAPE=TAPE%%A%%B, // TAPE=TAPE%%A.%%B, // PARM=PRM%%A%%.%%B, // PARM=PRM%%A%%..%%B, // PARM='%%A%%%BLANK3%%B', //DDN DD DSN=HLQ.DATASET.A%%A.%%B, //DDN DD DSN=HLQ.DATASET.A%%A..%%B, //DDN DD DSN=HLQ.DATASET.A%%A%%..%%B, //DDN DD DSN=HLQ.DATASET.A%%A%%B, |
// TAPE=TAPE100, // TAPE=TAPE1.2, // PARM=PRM12, // PARM=PRM1.2, // PARM=’1 2’, //DDN DD DSN=HLQ.DATASET.A12, //DDN DD DSN=HLQ.DATASET.A1.2, //DDN DD DSN=HLQ.DATASET.A1.2, //DDN DD DSN=HLQ.DATASET.A100, |
%%$ODATE%%BLANK5%%#AS-IS%%BLANK5%%WEEK |
20110716 %%AS-IS 28 |
This example shows resolution of date functions in the %%SET control statement.
Statement/Expression | Resolves as... |
---|---|
%%$YEARWK# %%$DATE %%$YEARWK# 20010214 %%$YEARWK# 20050101 %%$YEARWK# 20011231 %%$YEARWK# 20101220 %%$YEARWK# 20101227 %%$YEARWK# 20110102 %%$YEARWK# 20110103 %%$CALCDTE %%$ODATE +D1 %%$CALCDTE %%$ODATE +1 %%SET %%ADD_DATE=7 %%$CALCDTE %%$ODATE +%%ADD_DATE %%$CALCDTE 20110101 -1 %%$CALCDTE 20101231 +1 %%$CALCDTE 20110228 +1 %%$CALCDTE 20110228 +1 |
[2011W28] [2011W28] [2011W28] [2011W28] [2011W28] [2011W28] [2011W28] [2011W28] [20110717] [20110717] [7] [20110723] [20101231] [20110101] [20110301] [20110301] |
This example shows resolution of %%PLUS / %%MINUS in the %%SET control statement:
Statement/Expression | Resolves as... |
---|---|
%%SET %%_SCRATCH1=10 %%PLUS 25 %%SET %%_SCRATCH2= %%B %%MINUS %%A %%SET %%_SCRATCH3=%%A %%PLUS %%B |
[35] [1] [3] |
This example shows resolution of %%SUBSTR in the %%SET control statement:
Statement/Expression | Resolves as... |
---|---|
%%SET %%STR=00-01-02 %%SET %%TAPE_01=%%SUBSTR %%STR 4 2 %%SET %%TAPE_02=EE100002 %%SET %%TAPE_03=EE100003 %%SET %%TAPE_04=EE100004 %%SET %%TAPE_05=EE100005 %%SET %%TAPE_06=EE100006 %%SET %%TAPE_07=EE100007 %%SET %%TAPE_08=EE100008 %%SET %%TAPE_09=EE100009 %%SET %%TAPE_10=EE100010 %%SET %%TAPE_11=EE100011 %%SET %%TAPE_12=EE100012 // UNIT=TAPE,VOL=SER=TAPE%%TAPE_01, // UNIT=TAPE,VOL=SER=%%TAPE%%OMONTH, |
[00-01-02] [01] [EE100002] [EE100003] [EE100004] [EE100005] [EE100006] [EE100007] [EE100008] [EE100009] [EE100010] [EE100011] [EE100012] // UNIT=TAPE,VOL=SER=TAPE01, // UNIT=TAPE,VOL=SER=EE100007, |