ibc233 calling programs updated summer 2007. agenda assignments are mandatory assignment 2 due on...
TRANSCRIPT
IBC233
Calling Programs
Updated Summer 2007
Agenda
Assignments are mandatorybull Assignment 2 due on July 13 2007
bull Display files ndash lower case
bull Display files ndash packed date (4 bit vs 8 bit)
bull Calling Programs
bull Looping Logic
RESERVDF RESERVATION MAINTENANCE 30607 180930 ABERNS
WELCOME ABERNS RESERVATION NUMBER 1000000000 TELEPHONE NUMBER (123) 123-1234 RESERVATION NAME ASS ADDRESS1 SDSD ADDRESS2 CITY SDSD POSTAL CODE M1M1M1 ARRIVAL DATE 2007-03-01 SITE NAME SDSD NUMBER OF NIGHTS 2 ELECTRICAL Y SEWER Y WATER N WATERFRONT N NUMBER OF VEHICLES 0 NUMBER OF PEOPLE 2 PLEASE ENTER NUMBER OF PEOPLE(GREATER THAN 0) NUMBER OF TENTS 2 PLEASE ENTER NUMBER OF TENTS(GREATER THAN 0) PETS TOTAL COST 00 DEPOSIT 50 TOTAL DUE ON ARRIVAL 00
CONSISTENT and quiet for the eye
Eyes FOCUS - where RESERVDF Reservation Maintenance 30607
221645 Welcome ABERNS ABERNS Reservation Number _-------------------------- Enter Reservation Number Site Name ---------------------------------------------- Please fill in Site Address 1 ------------------------------------------------- Please enter address Address 2 City ---------------------------------------- Postal ------- Please enter City Telephone Number ------------------ Please enter postal in format AAA Please enter phone number Arrival Date -------------- Please enter a valid date Sewer -- Y N Number of nights How many nights Electrical -- Y N Number of Vehicles Water -- Y N Number of People How many people Waterfront -- Y N Number of tentscampers How many campers Pets -------------------------------------------------- Total Cost $ Deposit $ ------------- Total Due on Arrival $
Using ldquoTYPE amp EDITINGrdquo to get what you want
TELNUM 10Y 0B 6 24TEXT(TELEPHONE NUMBER) EDTWRD(0( )amp - ) or
TELNUM 10N 0B 6 24TEXT(TELEPHONE NUMBER) EDTWRD(0( )amp - )
DEPOSIT 7Y 2B 22 24TEXT(DEPOSIT) EDTCDE(3) Or
DEPOSIT 7S 2B 22 24TEXT(DEPOSIT) EDTCDE(3)
Lowercase in Display Files
bull Data is usually stored in UPPERCASEndash Why
bull Check keywordndash Function CHECK(LC) Lower case allowed
ME Must enter
FE Field exit
required
etc
OPM Call(original program model)
bull CALLndash Parameters
PGM
PARM
How it works
bull When the call statement is executedYour authority to the program object is checked
Do you have access to all the resources required
Gather resources
Program opened
ILE Call(Integrated Language Environment)
bull CALLPRC
Parameters
PRC
PARM
RTNVAL
How it works
bull When the application is created authority to modules is checked and entire application is bound
bull When application is called
all resources are allocated
entire application is opened
PGM PARM(ampPROGRAM ampLIB ampSECTION) DCL VAR(ampPROGRAM) TYPE(CHAR) LEN(10) DCL VAR(ampLIB) TYPE(CHAR) LEN(10) DCL VAR(ampSECTION) TYPE(CHAR) LEN(1) DCLF FILE(ABERNSCBLSTLST) RCVF
Mixing variable types is possible but also very DANGEROUS Both calling and called program must be aware of the data type of each
variable else the dreaded MCH1202 error might occur
(switching between 8 and 4 bit mode ndash unpacked and packed data)
PGM PARM(ampSTUDENTNO ampPASSWORD) receives student +
number from CHKMRK command
DCL VAR(ampSTUDENTNO) TYPE(CHAR) LEN(9)
DCL VAR(ampPASSWORD ) TYPE(CHAR) LEN(10)
DCL VAR(ampJOBUSER) TYPE(CHAR) LEN(12)
COURSE-USERID SECTION ASGN PROF-USERID
CALL PGM(OA0CHKALL) PARM( DB233 E A1 ABERNS)
CALL PGM(OA0CHKALL) PARM( DB233 B A3 MCKENNA)
PGM PARM(ampCRSUSERID ampSECT ampLIBSUFFIX ampPROF)
PARMs Course UserID Section code Asgn + Lib suffix Profs Userid
DCL VAR(ampCRSUSERID) TYPE(CHAR) LEN(5) course + User Id eg DC324 DCL VAR(ampSECT) TYPE(CHAR) LEN(1) SECTION DCL VAR(ampLIBSUFFIX) TYPE(CHAR) LEN(2) DCL VAR(ampPROF) TYPE(CHAR) LEN(10) DCL VAR(ampUSERID) TYPE(CHAR) LEN(10) DCL VAR(ampUSERTXT) TYPE(CHAR) LEN(50)
CALLING
CALLED
Advantages of OPM
bull Donrsquot have to have all parts of the application done to test
bull Parts of the application can be changed without affecting the entire application
Disadvantages of OPM
bull Integrated Language not supported
Advantages of ILE
bull Integrated Language Supportndash Best language for the task
bull You donrsquot have to pass all parameters to the program ndash previous values will be used
Disadvantages of ILE
bull All modules must be in place to test application
bull Version Control
DOWHILE Loopbull DCL VAR(ampLGL) TYPE(LGL)CHECK IF COND(NOT ampLGL) THEN(GOTO DONE) (group of CL commands)GOTO CHECKDONE
bull New-style coding exampleEvaluates COND at top of loop
DOWHILE COND(ampLGL) (group of CL commands) 1048773 body will be run zero or more timesENDDO
DOUNTIL Loop bull Old style coding exampleDCL VAR(ampLGL) TYPE(LGL)LOOP (group of CL commands)IF COND(NOT ampLGL) THEN(GOTO LOOP)
bull New style coding exampleEvaluates COND at bottom of loop
DOUNTIL COND(ampLGL) (group of CL commands) 1048773 body will be run one or more timesENDDO
DOFOR Loopbull SyntaxDOFOR VAR( ) FROM( ) TO( ) BY( )bullbull VAR must be INT or UINT variablebull FROM and TO can be integer constants expressions or
variablesbull BY must be an integer constant (can be negative)
defaults to 1 other parameters are requiredbull FROMTO expressions are evaluated at loop initiation TOevaluated after increment
DOFOR Loop (continued)bull Old-style coding example
DCL ampLOOPCTL TYPE(DEC) LEN(5 0)DCL ampLOOPLMT TYPE(DEC) LEN(5 0)CHGVAR ampLOOPCTL VALUE(1)CHECK IF COND(ampLOOPCTL GT ampLOOPLMT) THEN(GOTO DONE) (group of CL commands)CHGVAR ampLOOPCTL VALUE(ampLOOPCTL+1)GOTO CHECKDONE
bull New-style coding exampleChecks for loop exit at top of loop (like DOWHILE)
DCL ampLOOPCTL TYPE(INT) LEN(4)DCL ampLOOPLMT TYPE(INT) LEN(4)DOFOR VAR(ampLOOPCTL) FROM(1) TO(ampLOOPLMT) BY(1) (group of CL commands) 1048773 body will be run zero or more timesENDDO
LEAVE and ITERATEbull Allowed only within a DOWHILE DOUNTIL or DOFOR group
bull LEAVE passes control to next CL statement following loop ENDDObull ITERATE passes control to end of loop and tests loop exit condition
bull Both support CMDLBL (Command label) parameter to allowjump out of multiple (nested) loopsndash Both default to CURRENT loopbull Example (group of CL commands)IF (SST(ampNAME 1 10) EQ lsquoNONErsquo) THEN(LEAVE LOOP1)ELSE (DO)IF (SST(ampNAME 11 10) EQ lsquoLIBLrsquo) THEN(ITERATE)ENDDO (group of CL commands)
SELECT Groupbull SELECT starts a ldquoconditionrdquo groupbull ENDSELECT ends group
bull Group must have at least one WHENndash WHEN command has COND and THEN parameters (like IF)bull OTHERWISE (optional) run if no WHEN COND = Truendash OTHERWISE command has only CMD parameter (like ELSE)bull Example
SELECTWHEN COND(ampTYPE EQ CMD) THEN(DO) hellip(group of CL commands)ENDDOWHEN COND(ampTYPE EQ PGM) THEN(DO) helliphellip(group of CL commands)ENDDOhellipOTHERWISE CMD(CHGVAR ampBADTYPE lsquo1rsquo)ENDSELECT
Enhanced File Support
Will support up to 5 file instances using DCLF
bull Instances can be for the same or different files
bull New OPNID (Open identifier) parameter added to
DCLF statement
bull Default for OPNID is NONE
ndashOnly one DCLF allowed with OPNID(NONE)
bull OPNID accepts simple name up to 10 characters
Enhanced File Support (continued)
If OPNID specified declared CL variables areprefixed by this name and an underscore (egampMYTESTFILE_CUSTNAME )bull OPNID added to existing file IO CL commandsndash RCVFndashENDRCVndash SNDFndashSNDRCVFndash WAIT
File variables Identifier qualification
DCLF FILE(STUDENTS) OPNID(STPF) DCLF FILE(STUDDF) OPNID(DSPF) DCL ampEOF LGL 1 CHGVAR ampEOF 0 RCVF OPNID(STPF) DOWHILE (NOT ampDSPF-IN03) CHGVAR ampDSPF-FINESOWED ampSTPF-FINESOWED IF COND(ampDSPF-FEESOWED GT ampSTPF-FEESOWED) +
THEN(CHGVAR ampDSPF-IN30 1) IF COND(ampDSPF-FINESOWED NE ampSTPF-FINESOWED) +
THEN(CHGVAR ampDSPF-IN31 1) SNDRCVF OPNID(DSPF) RCVF OPNID(STPF)
PGM
DCLF FILE(RADIO) RCDFMT(PROMPT) DCL VAR(ampLEN) TYPE(DEC) LEN(2) DCL VAR(ampOPTION) TYPE(CHAR) LEN(50) DCL VAR(ampDIV) TYPE(CHAR) LEN(10) CALLPRC PRC(ASSIGN2B) PARM(ampDIV ampOPTION)
Called program receiving passed parameters
PGM PARM(ampDIVI ampOPTI) DCL VAR(ampDIVI) TYPE(CHAR) LEN(10) DCL VAR(ampOPTI) TYPE(CHAR) LEN(50)
IF (ampDIVI EQ DIVISION2) THEN(DO) OVRDBF FILE(INFILE) TOFILE(QGPLCHAP8AS2) + MBR(DIVISION2) POSITION(START) SHARE(YES) ENDDO OPNQRYF FILE((INFILE)) QRYSLT(ampOPTI) + KEYFLD((EMPNO)) CPYFRMQRYF FROMOPNID(INFILE) TOFILE(QTEMPCHAP8AS2) + MBROPT(REPLACE) CRTFILE(YES)
And passing it further down the line to another program utility or tool
Passing parameters by valuebull CALLPRC (Call Procedure) command
supports calls from ILE CL procedures to other ILE procedures
bull In prior releases CALLPRC only supported passing parameters by reference
bull Can specify BYREF or BYVAL special valuefor each parameter being passed
bull Enables ILE CL to call many MI and C functions and other procedure APIs
bull Maximum numbers of parameters 300
- IBC233
- Agenda
- Slide 3
- Eyes FOCUS - where
- Using ldquoTYPE amp EDITINGrdquo to get what you want
- Lowercase in Display Files
- OPM Call (original program model)
- How it works
- ILE Call (Integrated Language Environment)
- Slide 10
- Slide 11
- Slide 12
- Slide 13
- Advantages of OPM
- Disadvantages of OPM
- Advantages of ILE
- Disadvantages of ILE
- DOWHILE Loop
- DOUNTIL Loop
- DOFOR Loop
- DOFOR Loop (continued)
- LEAVE and ITERATE
- SELECT Group
- Enhanced File Support
- Enhanced File Support (continued)
- File variables Identifier qualification
- Slide 27
- Passing parameters by value
-
Agenda
Assignments are mandatorybull Assignment 2 due on July 13 2007
bull Display files ndash lower case
bull Display files ndash packed date (4 bit vs 8 bit)
bull Calling Programs
bull Looping Logic
RESERVDF RESERVATION MAINTENANCE 30607 180930 ABERNS
WELCOME ABERNS RESERVATION NUMBER 1000000000 TELEPHONE NUMBER (123) 123-1234 RESERVATION NAME ASS ADDRESS1 SDSD ADDRESS2 CITY SDSD POSTAL CODE M1M1M1 ARRIVAL DATE 2007-03-01 SITE NAME SDSD NUMBER OF NIGHTS 2 ELECTRICAL Y SEWER Y WATER N WATERFRONT N NUMBER OF VEHICLES 0 NUMBER OF PEOPLE 2 PLEASE ENTER NUMBER OF PEOPLE(GREATER THAN 0) NUMBER OF TENTS 2 PLEASE ENTER NUMBER OF TENTS(GREATER THAN 0) PETS TOTAL COST 00 DEPOSIT 50 TOTAL DUE ON ARRIVAL 00
CONSISTENT and quiet for the eye
Eyes FOCUS - where RESERVDF Reservation Maintenance 30607
221645 Welcome ABERNS ABERNS Reservation Number _-------------------------- Enter Reservation Number Site Name ---------------------------------------------- Please fill in Site Address 1 ------------------------------------------------- Please enter address Address 2 City ---------------------------------------- Postal ------- Please enter City Telephone Number ------------------ Please enter postal in format AAA Please enter phone number Arrival Date -------------- Please enter a valid date Sewer -- Y N Number of nights How many nights Electrical -- Y N Number of Vehicles Water -- Y N Number of People How many people Waterfront -- Y N Number of tentscampers How many campers Pets -------------------------------------------------- Total Cost $ Deposit $ ------------- Total Due on Arrival $
Using ldquoTYPE amp EDITINGrdquo to get what you want
TELNUM 10Y 0B 6 24TEXT(TELEPHONE NUMBER) EDTWRD(0( )amp - ) or
TELNUM 10N 0B 6 24TEXT(TELEPHONE NUMBER) EDTWRD(0( )amp - )
DEPOSIT 7Y 2B 22 24TEXT(DEPOSIT) EDTCDE(3) Or
DEPOSIT 7S 2B 22 24TEXT(DEPOSIT) EDTCDE(3)
Lowercase in Display Files
bull Data is usually stored in UPPERCASEndash Why
bull Check keywordndash Function CHECK(LC) Lower case allowed
ME Must enter
FE Field exit
required
etc
OPM Call(original program model)
bull CALLndash Parameters
PGM
PARM
How it works
bull When the call statement is executedYour authority to the program object is checked
Do you have access to all the resources required
Gather resources
Program opened
ILE Call(Integrated Language Environment)
bull CALLPRC
Parameters
PRC
PARM
RTNVAL
How it works
bull When the application is created authority to modules is checked and entire application is bound
bull When application is called
all resources are allocated
entire application is opened
PGM PARM(ampPROGRAM ampLIB ampSECTION) DCL VAR(ampPROGRAM) TYPE(CHAR) LEN(10) DCL VAR(ampLIB) TYPE(CHAR) LEN(10) DCL VAR(ampSECTION) TYPE(CHAR) LEN(1) DCLF FILE(ABERNSCBLSTLST) RCVF
Mixing variable types is possible but also very DANGEROUS Both calling and called program must be aware of the data type of each
variable else the dreaded MCH1202 error might occur
(switching between 8 and 4 bit mode ndash unpacked and packed data)
PGM PARM(ampSTUDENTNO ampPASSWORD) receives student +
number from CHKMRK command
DCL VAR(ampSTUDENTNO) TYPE(CHAR) LEN(9)
DCL VAR(ampPASSWORD ) TYPE(CHAR) LEN(10)
DCL VAR(ampJOBUSER) TYPE(CHAR) LEN(12)
COURSE-USERID SECTION ASGN PROF-USERID
CALL PGM(OA0CHKALL) PARM( DB233 E A1 ABERNS)
CALL PGM(OA0CHKALL) PARM( DB233 B A3 MCKENNA)
PGM PARM(ampCRSUSERID ampSECT ampLIBSUFFIX ampPROF)
PARMs Course UserID Section code Asgn + Lib suffix Profs Userid
DCL VAR(ampCRSUSERID) TYPE(CHAR) LEN(5) course + User Id eg DC324 DCL VAR(ampSECT) TYPE(CHAR) LEN(1) SECTION DCL VAR(ampLIBSUFFIX) TYPE(CHAR) LEN(2) DCL VAR(ampPROF) TYPE(CHAR) LEN(10) DCL VAR(ampUSERID) TYPE(CHAR) LEN(10) DCL VAR(ampUSERTXT) TYPE(CHAR) LEN(50)
CALLING
CALLED
Advantages of OPM
bull Donrsquot have to have all parts of the application done to test
bull Parts of the application can be changed without affecting the entire application
Disadvantages of OPM
bull Integrated Language not supported
Advantages of ILE
bull Integrated Language Supportndash Best language for the task
bull You donrsquot have to pass all parameters to the program ndash previous values will be used
Disadvantages of ILE
bull All modules must be in place to test application
bull Version Control
DOWHILE Loopbull DCL VAR(ampLGL) TYPE(LGL)CHECK IF COND(NOT ampLGL) THEN(GOTO DONE) (group of CL commands)GOTO CHECKDONE
bull New-style coding exampleEvaluates COND at top of loop
DOWHILE COND(ampLGL) (group of CL commands) 1048773 body will be run zero or more timesENDDO
DOUNTIL Loop bull Old style coding exampleDCL VAR(ampLGL) TYPE(LGL)LOOP (group of CL commands)IF COND(NOT ampLGL) THEN(GOTO LOOP)
bull New style coding exampleEvaluates COND at bottom of loop
DOUNTIL COND(ampLGL) (group of CL commands) 1048773 body will be run one or more timesENDDO
DOFOR Loopbull SyntaxDOFOR VAR( ) FROM( ) TO( ) BY( )bullbull VAR must be INT or UINT variablebull FROM and TO can be integer constants expressions or
variablesbull BY must be an integer constant (can be negative)
defaults to 1 other parameters are requiredbull FROMTO expressions are evaluated at loop initiation TOevaluated after increment
DOFOR Loop (continued)bull Old-style coding example
DCL ampLOOPCTL TYPE(DEC) LEN(5 0)DCL ampLOOPLMT TYPE(DEC) LEN(5 0)CHGVAR ampLOOPCTL VALUE(1)CHECK IF COND(ampLOOPCTL GT ampLOOPLMT) THEN(GOTO DONE) (group of CL commands)CHGVAR ampLOOPCTL VALUE(ampLOOPCTL+1)GOTO CHECKDONE
bull New-style coding exampleChecks for loop exit at top of loop (like DOWHILE)
DCL ampLOOPCTL TYPE(INT) LEN(4)DCL ampLOOPLMT TYPE(INT) LEN(4)DOFOR VAR(ampLOOPCTL) FROM(1) TO(ampLOOPLMT) BY(1) (group of CL commands) 1048773 body will be run zero or more timesENDDO
LEAVE and ITERATEbull Allowed only within a DOWHILE DOUNTIL or DOFOR group
bull LEAVE passes control to next CL statement following loop ENDDObull ITERATE passes control to end of loop and tests loop exit condition
bull Both support CMDLBL (Command label) parameter to allowjump out of multiple (nested) loopsndash Both default to CURRENT loopbull Example (group of CL commands)IF (SST(ampNAME 1 10) EQ lsquoNONErsquo) THEN(LEAVE LOOP1)ELSE (DO)IF (SST(ampNAME 11 10) EQ lsquoLIBLrsquo) THEN(ITERATE)ENDDO (group of CL commands)
SELECT Groupbull SELECT starts a ldquoconditionrdquo groupbull ENDSELECT ends group
bull Group must have at least one WHENndash WHEN command has COND and THEN parameters (like IF)bull OTHERWISE (optional) run if no WHEN COND = Truendash OTHERWISE command has only CMD parameter (like ELSE)bull Example
SELECTWHEN COND(ampTYPE EQ CMD) THEN(DO) hellip(group of CL commands)ENDDOWHEN COND(ampTYPE EQ PGM) THEN(DO) helliphellip(group of CL commands)ENDDOhellipOTHERWISE CMD(CHGVAR ampBADTYPE lsquo1rsquo)ENDSELECT
Enhanced File Support
Will support up to 5 file instances using DCLF
bull Instances can be for the same or different files
bull New OPNID (Open identifier) parameter added to
DCLF statement
bull Default for OPNID is NONE
ndashOnly one DCLF allowed with OPNID(NONE)
bull OPNID accepts simple name up to 10 characters
Enhanced File Support (continued)
If OPNID specified declared CL variables areprefixed by this name and an underscore (egampMYTESTFILE_CUSTNAME )bull OPNID added to existing file IO CL commandsndash RCVFndashENDRCVndash SNDFndashSNDRCVFndash WAIT
File variables Identifier qualification
DCLF FILE(STUDENTS) OPNID(STPF) DCLF FILE(STUDDF) OPNID(DSPF) DCL ampEOF LGL 1 CHGVAR ampEOF 0 RCVF OPNID(STPF) DOWHILE (NOT ampDSPF-IN03) CHGVAR ampDSPF-FINESOWED ampSTPF-FINESOWED IF COND(ampDSPF-FEESOWED GT ampSTPF-FEESOWED) +
THEN(CHGVAR ampDSPF-IN30 1) IF COND(ampDSPF-FINESOWED NE ampSTPF-FINESOWED) +
THEN(CHGVAR ampDSPF-IN31 1) SNDRCVF OPNID(DSPF) RCVF OPNID(STPF)
PGM
DCLF FILE(RADIO) RCDFMT(PROMPT) DCL VAR(ampLEN) TYPE(DEC) LEN(2) DCL VAR(ampOPTION) TYPE(CHAR) LEN(50) DCL VAR(ampDIV) TYPE(CHAR) LEN(10) CALLPRC PRC(ASSIGN2B) PARM(ampDIV ampOPTION)
Called program receiving passed parameters
PGM PARM(ampDIVI ampOPTI) DCL VAR(ampDIVI) TYPE(CHAR) LEN(10) DCL VAR(ampOPTI) TYPE(CHAR) LEN(50)
IF (ampDIVI EQ DIVISION2) THEN(DO) OVRDBF FILE(INFILE) TOFILE(QGPLCHAP8AS2) + MBR(DIVISION2) POSITION(START) SHARE(YES) ENDDO OPNQRYF FILE((INFILE)) QRYSLT(ampOPTI) + KEYFLD((EMPNO)) CPYFRMQRYF FROMOPNID(INFILE) TOFILE(QTEMPCHAP8AS2) + MBROPT(REPLACE) CRTFILE(YES)
And passing it further down the line to another program utility or tool
Passing parameters by valuebull CALLPRC (Call Procedure) command
supports calls from ILE CL procedures to other ILE procedures
bull In prior releases CALLPRC only supported passing parameters by reference
bull Can specify BYREF or BYVAL special valuefor each parameter being passed
bull Enables ILE CL to call many MI and C functions and other procedure APIs
bull Maximum numbers of parameters 300
- IBC233
- Agenda
- Slide 3
- Eyes FOCUS - where
- Using ldquoTYPE amp EDITINGrdquo to get what you want
- Lowercase in Display Files
- OPM Call (original program model)
- How it works
- ILE Call (Integrated Language Environment)
- Slide 10
- Slide 11
- Slide 12
- Slide 13
- Advantages of OPM
- Disadvantages of OPM
- Advantages of ILE
- Disadvantages of ILE
- DOWHILE Loop
- DOUNTIL Loop
- DOFOR Loop
- DOFOR Loop (continued)
- LEAVE and ITERATE
- SELECT Group
- Enhanced File Support
- Enhanced File Support (continued)
- File variables Identifier qualification
- Slide 27
- Passing parameters by value
-
RESERVDF RESERVATION MAINTENANCE 30607 180930 ABERNS
WELCOME ABERNS RESERVATION NUMBER 1000000000 TELEPHONE NUMBER (123) 123-1234 RESERVATION NAME ASS ADDRESS1 SDSD ADDRESS2 CITY SDSD POSTAL CODE M1M1M1 ARRIVAL DATE 2007-03-01 SITE NAME SDSD NUMBER OF NIGHTS 2 ELECTRICAL Y SEWER Y WATER N WATERFRONT N NUMBER OF VEHICLES 0 NUMBER OF PEOPLE 2 PLEASE ENTER NUMBER OF PEOPLE(GREATER THAN 0) NUMBER OF TENTS 2 PLEASE ENTER NUMBER OF TENTS(GREATER THAN 0) PETS TOTAL COST 00 DEPOSIT 50 TOTAL DUE ON ARRIVAL 00
CONSISTENT and quiet for the eye
Eyes FOCUS - where RESERVDF Reservation Maintenance 30607
221645 Welcome ABERNS ABERNS Reservation Number _-------------------------- Enter Reservation Number Site Name ---------------------------------------------- Please fill in Site Address 1 ------------------------------------------------- Please enter address Address 2 City ---------------------------------------- Postal ------- Please enter City Telephone Number ------------------ Please enter postal in format AAA Please enter phone number Arrival Date -------------- Please enter a valid date Sewer -- Y N Number of nights How many nights Electrical -- Y N Number of Vehicles Water -- Y N Number of People How many people Waterfront -- Y N Number of tentscampers How many campers Pets -------------------------------------------------- Total Cost $ Deposit $ ------------- Total Due on Arrival $
Using ldquoTYPE amp EDITINGrdquo to get what you want
TELNUM 10Y 0B 6 24TEXT(TELEPHONE NUMBER) EDTWRD(0( )amp - ) or
TELNUM 10N 0B 6 24TEXT(TELEPHONE NUMBER) EDTWRD(0( )amp - )
DEPOSIT 7Y 2B 22 24TEXT(DEPOSIT) EDTCDE(3) Or
DEPOSIT 7S 2B 22 24TEXT(DEPOSIT) EDTCDE(3)
Lowercase in Display Files
bull Data is usually stored in UPPERCASEndash Why
bull Check keywordndash Function CHECK(LC) Lower case allowed
ME Must enter
FE Field exit
required
etc
OPM Call(original program model)
bull CALLndash Parameters
PGM
PARM
How it works
bull When the call statement is executedYour authority to the program object is checked
Do you have access to all the resources required
Gather resources
Program opened
ILE Call(Integrated Language Environment)
bull CALLPRC
Parameters
PRC
PARM
RTNVAL
How it works
bull When the application is created authority to modules is checked and entire application is bound
bull When application is called
all resources are allocated
entire application is opened
PGM PARM(ampPROGRAM ampLIB ampSECTION) DCL VAR(ampPROGRAM) TYPE(CHAR) LEN(10) DCL VAR(ampLIB) TYPE(CHAR) LEN(10) DCL VAR(ampSECTION) TYPE(CHAR) LEN(1) DCLF FILE(ABERNSCBLSTLST) RCVF
Mixing variable types is possible but also very DANGEROUS Both calling and called program must be aware of the data type of each
variable else the dreaded MCH1202 error might occur
(switching between 8 and 4 bit mode ndash unpacked and packed data)
PGM PARM(ampSTUDENTNO ampPASSWORD) receives student +
number from CHKMRK command
DCL VAR(ampSTUDENTNO) TYPE(CHAR) LEN(9)
DCL VAR(ampPASSWORD ) TYPE(CHAR) LEN(10)
DCL VAR(ampJOBUSER) TYPE(CHAR) LEN(12)
COURSE-USERID SECTION ASGN PROF-USERID
CALL PGM(OA0CHKALL) PARM( DB233 E A1 ABERNS)
CALL PGM(OA0CHKALL) PARM( DB233 B A3 MCKENNA)
PGM PARM(ampCRSUSERID ampSECT ampLIBSUFFIX ampPROF)
PARMs Course UserID Section code Asgn + Lib suffix Profs Userid
DCL VAR(ampCRSUSERID) TYPE(CHAR) LEN(5) course + User Id eg DC324 DCL VAR(ampSECT) TYPE(CHAR) LEN(1) SECTION DCL VAR(ampLIBSUFFIX) TYPE(CHAR) LEN(2) DCL VAR(ampPROF) TYPE(CHAR) LEN(10) DCL VAR(ampUSERID) TYPE(CHAR) LEN(10) DCL VAR(ampUSERTXT) TYPE(CHAR) LEN(50)
CALLING
CALLED
Advantages of OPM
bull Donrsquot have to have all parts of the application done to test
bull Parts of the application can be changed without affecting the entire application
Disadvantages of OPM
bull Integrated Language not supported
Advantages of ILE
bull Integrated Language Supportndash Best language for the task
bull You donrsquot have to pass all parameters to the program ndash previous values will be used
Disadvantages of ILE
bull All modules must be in place to test application
bull Version Control
DOWHILE Loopbull DCL VAR(ampLGL) TYPE(LGL)CHECK IF COND(NOT ampLGL) THEN(GOTO DONE) (group of CL commands)GOTO CHECKDONE
bull New-style coding exampleEvaluates COND at top of loop
DOWHILE COND(ampLGL) (group of CL commands) 1048773 body will be run zero or more timesENDDO
DOUNTIL Loop bull Old style coding exampleDCL VAR(ampLGL) TYPE(LGL)LOOP (group of CL commands)IF COND(NOT ampLGL) THEN(GOTO LOOP)
bull New style coding exampleEvaluates COND at bottom of loop
DOUNTIL COND(ampLGL) (group of CL commands) 1048773 body will be run one or more timesENDDO
DOFOR Loopbull SyntaxDOFOR VAR( ) FROM( ) TO( ) BY( )bullbull VAR must be INT or UINT variablebull FROM and TO can be integer constants expressions or
variablesbull BY must be an integer constant (can be negative)
defaults to 1 other parameters are requiredbull FROMTO expressions are evaluated at loop initiation TOevaluated after increment
DOFOR Loop (continued)bull Old-style coding example
DCL ampLOOPCTL TYPE(DEC) LEN(5 0)DCL ampLOOPLMT TYPE(DEC) LEN(5 0)CHGVAR ampLOOPCTL VALUE(1)CHECK IF COND(ampLOOPCTL GT ampLOOPLMT) THEN(GOTO DONE) (group of CL commands)CHGVAR ampLOOPCTL VALUE(ampLOOPCTL+1)GOTO CHECKDONE
bull New-style coding exampleChecks for loop exit at top of loop (like DOWHILE)
DCL ampLOOPCTL TYPE(INT) LEN(4)DCL ampLOOPLMT TYPE(INT) LEN(4)DOFOR VAR(ampLOOPCTL) FROM(1) TO(ampLOOPLMT) BY(1) (group of CL commands) 1048773 body will be run zero or more timesENDDO
LEAVE and ITERATEbull Allowed only within a DOWHILE DOUNTIL or DOFOR group
bull LEAVE passes control to next CL statement following loop ENDDObull ITERATE passes control to end of loop and tests loop exit condition
bull Both support CMDLBL (Command label) parameter to allowjump out of multiple (nested) loopsndash Both default to CURRENT loopbull Example (group of CL commands)IF (SST(ampNAME 1 10) EQ lsquoNONErsquo) THEN(LEAVE LOOP1)ELSE (DO)IF (SST(ampNAME 11 10) EQ lsquoLIBLrsquo) THEN(ITERATE)ENDDO (group of CL commands)
SELECT Groupbull SELECT starts a ldquoconditionrdquo groupbull ENDSELECT ends group
bull Group must have at least one WHENndash WHEN command has COND and THEN parameters (like IF)bull OTHERWISE (optional) run if no WHEN COND = Truendash OTHERWISE command has only CMD parameter (like ELSE)bull Example
SELECTWHEN COND(ampTYPE EQ CMD) THEN(DO) hellip(group of CL commands)ENDDOWHEN COND(ampTYPE EQ PGM) THEN(DO) helliphellip(group of CL commands)ENDDOhellipOTHERWISE CMD(CHGVAR ampBADTYPE lsquo1rsquo)ENDSELECT
Enhanced File Support
Will support up to 5 file instances using DCLF
bull Instances can be for the same or different files
bull New OPNID (Open identifier) parameter added to
DCLF statement
bull Default for OPNID is NONE
ndashOnly one DCLF allowed with OPNID(NONE)
bull OPNID accepts simple name up to 10 characters
Enhanced File Support (continued)
If OPNID specified declared CL variables areprefixed by this name and an underscore (egampMYTESTFILE_CUSTNAME )bull OPNID added to existing file IO CL commandsndash RCVFndashENDRCVndash SNDFndashSNDRCVFndash WAIT
File variables Identifier qualification
DCLF FILE(STUDENTS) OPNID(STPF) DCLF FILE(STUDDF) OPNID(DSPF) DCL ampEOF LGL 1 CHGVAR ampEOF 0 RCVF OPNID(STPF) DOWHILE (NOT ampDSPF-IN03) CHGVAR ampDSPF-FINESOWED ampSTPF-FINESOWED IF COND(ampDSPF-FEESOWED GT ampSTPF-FEESOWED) +
THEN(CHGVAR ampDSPF-IN30 1) IF COND(ampDSPF-FINESOWED NE ampSTPF-FINESOWED) +
THEN(CHGVAR ampDSPF-IN31 1) SNDRCVF OPNID(DSPF) RCVF OPNID(STPF)
PGM
DCLF FILE(RADIO) RCDFMT(PROMPT) DCL VAR(ampLEN) TYPE(DEC) LEN(2) DCL VAR(ampOPTION) TYPE(CHAR) LEN(50) DCL VAR(ampDIV) TYPE(CHAR) LEN(10) CALLPRC PRC(ASSIGN2B) PARM(ampDIV ampOPTION)
Called program receiving passed parameters
PGM PARM(ampDIVI ampOPTI) DCL VAR(ampDIVI) TYPE(CHAR) LEN(10) DCL VAR(ampOPTI) TYPE(CHAR) LEN(50)
IF (ampDIVI EQ DIVISION2) THEN(DO) OVRDBF FILE(INFILE) TOFILE(QGPLCHAP8AS2) + MBR(DIVISION2) POSITION(START) SHARE(YES) ENDDO OPNQRYF FILE((INFILE)) QRYSLT(ampOPTI) + KEYFLD((EMPNO)) CPYFRMQRYF FROMOPNID(INFILE) TOFILE(QTEMPCHAP8AS2) + MBROPT(REPLACE) CRTFILE(YES)
And passing it further down the line to another program utility or tool
Passing parameters by valuebull CALLPRC (Call Procedure) command
supports calls from ILE CL procedures to other ILE procedures
bull In prior releases CALLPRC only supported passing parameters by reference
bull Can specify BYREF or BYVAL special valuefor each parameter being passed
bull Enables ILE CL to call many MI and C functions and other procedure APIs
bull Maximum numbers of parameters 300
- IBC233
- Agenda
- Slide 3
- Eyes FOCUS - where
- Using ldquoTYPE amp EDITINGrdquo to get what you want
- Lowercase in Display Files
- OPM Call (original program model)
- How it works
- ILE Call (Integrated Language Environment)
- Slide 10
- Slide 11
- Slide 12
- Slide 13
- Advantages of OPM
- Disadvantages of OPM
- Advantages of ILE
- Disadvantages of ILE
- DOWHILE Loop
- DOUNTIL Loop
- DOFOR Loop
- DOFOR Loop (continued)
- LEAVE and ITERATE
- SELECT Group
- Enhanced File Support
- Enhanced File Support (continued)
- File variables Identifier qualification
- Slide 27
- Passing parameters by value
-
Eyes FOCUS - where RESERVDF Reservation Maintenance 30607
221645 Welcome ABERNS ABERNS Reservation Number _-------------------------- Enter Reservation Number Site Name ---------------------------------------------- Please fill in Site Address 1 ------------------------------------------------- Please enter address Address 2 City ---------------------------------------- Postal ------- Please enter City Telephone Number ------------------ Please enter postal in format AAA Please enter phone number Arrival Date -------------- Please enter a valid date Sewer -- Y N Number of nights How many nights Electrical -- Y N Number of Vehicles Water -- Y N Number of People How many people Waterfront -- Y N Number of tentscampers How many campers Pets -------------------------------------------------- Total Cost $ Deposit $ ------------- Total Due on Arrival $
Using ldquoTYPE amp EDITINGrdquo to get what you want
TELNUM 10Y 0B 6 24TEXT(TELEPHONE NUMBER) EDTWRD(0( )amp - ) or
TELNUM 10N 0B 6 24TEXT(TELEPHONE NUMBER) EDTWRD(0( )amp - )
DEPOSIT 7Y 2B 22 24TEXT(DEPOSIT) EDTCDE(3) Or
DEPOSIT 7S 2B 22 24TEXT(DEPOSIT) EDTCDE(3)
Lowercase in Display Files
bull Data is usually stored in UPPERCASEndash Why
bull Check keywordndash Function CHECK(LC) Lower case allowed
ME Must enter
FE Field exit
required
etc
OPM Call(original program model)
bull CALLndash Parameters
PGM
PARM
How it works
bull When the call statement is executedYour authority to the program object is checked
Do you have access to all the resources required
Gather resources
Program opened
ILE Call(Integrated Language Environment)
bull CALLPRC
Parameters
PRC
PARM
RTNVAL
How it works
bull When the application is created authority to modules is checked and entire application is bound
bull When application is called
all resources are allocated
entire application is opened
PGM PARM(ampPROGRAM ampLIB ampSECTION) DCL VAR(ampPROGRAM) TYPE(CHAR) LEN(10) DCL VAR(ampLIB) TYPE(CHAR) LEN(10) DCL VAR(ampSECTION) TYPE(CHAR) LEN(1) DCLF FILE(ABERNSCBLSTLST) RCVF
Mixing variable types is possible but also very DANGEROUS Both calling and called program must be aware of the data type of each
variable else the dreaded MCH1202 error might occur
(switching between 8 and 4 bit mode ndash unpacked and packed data)
PGM PARM(ampSTUDENTNO ampPASSWORD) receives student +
number from CHKMRK command
DCL VAR(ampSTUDENTNO) TYPE(CHAR) LEN(9)
DCL VAR(ampPASSWORD ) TYPE(CHAR) LEN(10)
DCL VAR(ampJOBUSER) TYPE(CHAR) LEN(12)
COURSE-USERID SECTION ASGN PROF-USERID
CALL PGM(OA0CHKALL) PARM( DB233 E A1 ABERNS)
CALL PGM(OA0CHKALL) PARM( DB233 B A3 MCKENNA)
PGM PARM(ampCRSUSERID ampSECT ampLIBSUFFIX ampPROF)
PARMs Course UserID Section code Asgn + Lib suffix Profs Userid
DCL VAR(ampCRSUSERID) TYPE(CHAR) LEN(5) course + User Id eg DC324 DCL VAR(ampSECT) TYPE(CHAR) LEN(1) SECTION DCL VAR(ampLIBSUFFIX) TYPE(CHAR) LEN(2) DCL VAR(ampPROF) TYPE(CHAR) LEN(10) DCL VAR(ampUSERID) TYPE(CHAR) LEN(10) DCL VAR(ampUSERTXT) TYPE(CHAR) LEN(50)
CALLING
CALLED
Advantages of OPM
bull Donrsquot have to have all parts of the application done to test
bull Parts of the application can be changed without affecting the entire application
Disadvantages of OPM
bull Integrated Language not supported
Advantages of ILE
bull Integrated Language Supportndash Best language for the task
bull You donrsquot have to pass all parameters to the program ndash previous values will be used
Disadvantages of ILE
bull All modules must be in place to test application
bull Version Control
DOWHILE Loopbull DCL VAR(ampLGL) TYPE(LGL)CHECK IF COND(NOT ampLGL) THEN(GOTO DONE) (group of CL commands)GOTO CHECKDONE
bull New-style coding exampleEvaluates COND at top of loop
DOWHILE COND(ampLGL) (group of CL commands) 1048773 body will be run zero or more timesENDDO
DOUNTIL Loop bull Old style coding exampleDCL VAR(ampLGL) TYPE(LGL)LOOP (group of CL commands)IF COND(NOT ampLGL) THEN(GOTO LOOP)
bull New style coding exampleEvaluates COND at bottom of loop
DOUNTIL COND(ampLGL) (group of CL commands) 1048773 body will be run one or more timesENDDO
DOFOR Loopbull SyntaxDOFOR VAR( ) FROM( ) TO( ) BY( )bullbull VAR must be INT or UINT variablebull FROM and TO can be integer constants expressions or
variablesbull BY must be an integer constant (can be negative)
defaults to 1 other parameters are requiredbull FROMTO expressions are evaluated at loop initiation TOevaluated after increment
DOFOR Loop (continued)bull Old-style coding example
DCL ampLOOPCTL TYPE(DEC) LEN(5 0)DCL ampLOOPLMT TYPE(DEC) LEN(5 0)CHGVAR ampLOOPCTL VALUE(1)CHECK IF COND(ampLOOPCTL GT ampLOOPLMT) THEN(GOTO DONE) (group of CL commands)CHGVAR ampLOOPCTL VALUE(ampLOOPCTL+1)GOTO CHECKDONE
bull New-style coding exampleChecks for loop exit at top of loop (like DOWHILE)
DCL ampLOOPCTL TYPE(INT) LEN(4)DCL ampLOOPLMT TYPE(INT) LEN(4)DOFOR VAR(ampLOOPCTL) FROM(1) TO(ampLOOPLMT) BY(1) (group of CL commands) 1048773 body will be run zero or more timesENDDO
LEAVE and ITERATEbull Allowed only within a DOWHILE DOUNTIL or DOFOR group
bull LEAVE passes control to next CL statement following loop ENDDObull ITERATE passes control to end of loop and tests loop exit condition
bull Both support CMDLBL (Command label) parameter to allowjump out of multiple (nested) loopsndash Both default to CURRENT loopbull Example (group of CL commands)IF (SST(ampNAME 1 10) EQ lsquoNONErsquo) THEN(LEAVE LOOP1)ELSE (DO)IF (SST(ampNAME 11 10) EQ lsquoLIBLrsquo) THEN(ITERATE)ENDDO (group of CL commands)
SELECT Groupbull SELECT starts a ldquoconditionrdquo groupbull ENDSELECT ends group
bull Group must have at least one WHENndash WHEN command has COND and THEN parameters (like IF)bull OTHERWISE (optional) run if no WHEN COND = Truendash OTHERWISE command has only CMD parameter (like ELSE)bull Example
SELECTWHEN COND(ampTYPE EQ CMD) THEN(DO) hellip(group of CL commands)ENDDOWHEN COND(ampTYPE EQ PGM) THEN(DO) helliphellip(group of CL commands)ENDDOhellipOTHERWISE CMD(CHGVAR ampBADTYPE lsquo1rsquo)ENDSELECT
Enhanced File Support
Will support up to 5 file instances using DCLF
bull Instances can be for the same or different files
bull New OPNID (Open identifier) parameter added to
DCLF statement
bull Default for OPNID is NONE
ndashOnly one DCLF allowed with OPNID(NONE)
bull OPNID accepts simple name up to 10 characters
Enhanced File Support (continued)
If OPNID specified declared CL variables areprefixed by this name and an underscore (egampMYTESTFILE_CUSTNAME )bull OPNID added to existing file IO CL commandsndash RCVFndashENDRCVndash SNDFndashSNDRCVFndash WAIT
File variables Identifier qualification
DCLF FILE(STUDENTS) OPNID(STPF) DCLF FILE(STUDDF) OPNID(DSPF) DCL ampEOF LGL 1 CHGVAR ampEOF 0 RCVF OPNID(STPF) DOWHILE (NOT ampDSPF-IN03) CHGVAR ampDSPF-FINESOWED ampSTPF-FINESOWED IF COND(ampDSPF-FEESOWED GT ampSTPF-FEESOWED) +
THEN(CHGVAR ampDSPF-IN30 1) IF COND(ampDSPF-FINESOWED NE ampSTPF-FINESOWED) +
THEN(CHGVAR ampDSPF-IN31 1) SNDRCVF OPNID(DSPF) RCVF OPNID(STPF)
PGM
DCLF FILE(RADIO) RCDFMT(PROMPT) DCL VAR(ampLEN) TYPE(DEC) LEN(2) DCL VAR(ampOPTION) TYPE(CHAR) LEN(50) DCL VAR(ampDIV) TYPE(CHAR) LEN(10) CALLPRC PRC(ASSIGN2B) PARM(ampDIV ampOPTION)
Called program receiving passed parameters
PGM PARM(ampDIVI ampOPTI) DCL VAR(ampDIVI) TYPE(CHAR) LEN(10) DCL VAR(ampOPTI) TYPE(CHAR) LEN(50)
IF (ampDIVI EQ DIVISION2) THEN(DO) OVRDBF FILE(INFILE) TOFILE(QGPLCHAP8AS2) + MBR(DIVISION2) POSITION(START) SHARE(YES) ENDDO OPNQRYF FILE((INFILE)) QRYSLT(ampOPTI) + KEYFLD((EMPNO)) CPYFRMQRYF FROMOPNID(INFILE) TOFILE(QTEMPCHAP8AS2) + MBROPT(REPLACE) CRTFILE(YES)
And passing it further down the line to another program utility or tool
Passing parameters by valuebull CALLPRC (Call Procedure) command
supports calls from ILE CL procedures to other ILE procedures
bull In prior releases CALLPRC only supported passing parameters by reference
bull Can specify BYREF or BYVAL special valuefor each parameter being passed
bull Enables ILE CL to call many MI and C functions and other procedure APIs
bull Maximum numbers of parameters 300
- IBC233
- Agenda
- Slide 3
- Eyes FOCUS - where
- Using ldquoTYPE amp EDITINGrdquo to get what you want
- Lowercase in Display Files
- OPM Call (original program model)
- How it works
- ILE Call (Integrated Language Environment)
- Slide 10
- Slide 11
- Slide 12
- Slide 13
- Advantages of OPM
- Disadvantages of OPM
- Advantages of ILE
- Disadvantages of ILE
- DOWHILE Loop
- DOUNTIL Loop
- DOFOR Loop
- DOFOR Loop (continued)
- LEAVE and ITERATE
- SELECT Group
- Enhanced File Support
- Enhanced File Support (continued)
- File variables Identifier qualification
- Slide 27
- Passing parameters by value
-
Using ldquoTYPE amp EDITINGrdquo to get what you want
TELNUM 10Y 0B 6 24TEXT(TELEPHONE NUMBER) EDTWRD(0( )amp - ) or
TELNUM 10N 0B 6 24TEXT(TELEPHONE NUMBER) EDTWRD(0( )amp - )
DEPOSIT 7Y 2B 22 24TEXT(DEPOSIT) EDTCDE(3) Or
DEPOSIT 7S 2B 22 24TEXT(DEPOSIT) EDTCDE(3)
Lowercase in Display Files
bull Data is usually stored in UPPERCASEndash Why
bull Check keywordndash Function CHECK(LC) Lower case allowed
ME Must enter
FE Field exit
required
etc
OPM Call(original program model)
bull CALLndash Parameters
PGM
PARM
How it works
bull When the call statement is executedYour authority to the program object is checked
Do you have access to all the resources required
Gather resources
Program opened
ILE Call(Integrated Language Environment)
bull CALLPRC
Parameters
PRC
PARM
RTNVAL
How it works
bull When the application is created authority to modules is checked and entire application is bound
bull When application is called
all resources are allocated
entire application is opened
PGM PARM(ampPROGRAM ampLIB ampSECTION) DCL VAR(ampPROGRAM) TYPE(CHAR) LEN(10) DCL VAR(ampLIB) TYPE(CHAR) LEN(10) DCL VAR(ampSECTION) TYPE(CHAR) LEN(1) DCLF FILE(ABERNSCBLSTLST) RCVF
Mixing variable types is possible but also very DANGEROUS Both calling and called program must be aware of the data type of each
variable else the dreaded MCH1202 error might occur
(switching between 8 and 4 bit mode ndash unpacked and packed data)
PGM PARM(ampSTUDENTNO ampPASSWORD) receives student +
number from CHKMRK command
DCL VAR(ampSTUDENTNO) TYPE(CHAR) LEN(9)
DCL VAR(ampPASSWORD ) TYPE(CHAR) LEN(10)
DCL VAR(ampJOBUSER) TYPE(CHAR) LEN(12)
COURSE-USERID SECTION ASGN PROF-USERID
CALL PGM(OA0CHKALL) PARM( DB233 E A1 ABERNS)
CALL PGM(OA0CHKALL) PARM( DB233 B A3 MCKENNA)
PGM PARM(ampCRSUSERID ampSECT ampLIBSUFFIX ampPROF)
PARMs Course UserID Section code Asgn + Lib suffix Profs Userid
DCL VAR(ampCRSUSERID) TYPE(CHAR) LEN(5) course + User Id eg DC324 DCL VAR(ampSECT) TYPE(CHAR) LEN(1) SECTION DCL VAR(ampLIBSUFFIX) TYPE(CHAR) LEN(2) DCL VAR(ampPROF) TYPE(CHAR) LEN(10) DCL VAR(ampUSERID) TYPE(CHAR) LEN(10) DCL VAR(ampUSERTXT) TYPE(CHAR) LEN(50)
CALLING
CALLED
Advantages of OPM
bull Donrsquot have to have all parts of the application done to test
bull Parts of the application can be changed without affecting the entire application
Disadvantages of OPM
bull Integrated Language not supported
Advantages of ILE
bull Integrated Language Supportndash Best language for the task
bull You donrsquot have to pass all parameters to the program ndash previous values will be used
Disadvantages of ILE
bull All modules must be in place to test application
bull Version Control
DOWHILE Loopbull DCL VAR(ampLGL) TYPE(LGL)CHECK IF COND(NOT ampLGL) THEN(GOTO DONE) (group of CL commands)GOTO CHECKDONE
bull New-style coding exampleEvaluates COND at top of loop
DOWHILE COND(ampLGL) (group of CL commands) 1048773 body will be run zero or more timesENDDO
DOUNTIL Loop bull Old style coding exampleDCL VAR(ampLGL) TYPE(LGL)LOOP (group of CL commands)IF COND(NOT ampLGL) THEN(GOTO LOOP)
bull New style coding exampleEvaluates COND at bottom of loop
DOUNTIL COND(ampLGL) (group of CL commands) 1048773 body will be run one or more timesENDDO
DOFOR Loopbull SyntaxDOFOR VAR( ) FROM( ) TO( ) BY( )bullbull VAR must be INT or UINT variablebull FROM and TO can be integer constants expressions or
variablesbull BY must be an integer constant (can be negative)
defaults to 1 other parameters are requiredbull FROMTO expressions are evaluated at loop initiation TOevaluated after increment
DOFOR Loop (continued)bull Old-style coding example
DCL ampLOOPCTL TYPE(DEC) LEN(5 0)DCL ampLOOPLMT TYPE(DEC) LEN(5 0)CHGVAR ampLOOPCTL VALUE(1)CHECK IF COND(ampLOOPCTL GT ampLOOPLMT) THEN(GOTO DONE) (group of CL commands)CHGVAR ampLOOPCTL VALUE(ampLOOPCTL+1)GOTO CHECKDONE
bull New-style coding exampleChecks for loop exit at top of loop (like DOWHILE)
DCL ampLOOPCTL TYPE(INT) LEN(4)DCL ampLOOPLMT TYPE(INT) LEN(4)DOFOR VAR(ampLOOPCTL) FROM(1) TO(ampLOOPLMT) BY(1) (group of CL commands) 1048773 body will be run zero or more timesENDDO
LEAVE and ITERATEbull Allowed only within a DOWHILE DOUNTIL or DOFOR group
bull LEAVE passes control to next CL statement following loop ENDDObull ITERATE passes control to end of loop and tests loop exit condition
bull Both support CMDLBL (Command label) parameter to allowjump out of multiple (nested) loopsndash Both default to CURRENT loopbull Example (group of CL commands)IF (SST(ampNAME 1 10) EQ lsquoNONErsquo) THEN(LEAVE LOOP1)ELSE (DO)IF (SST(ampNAME 11 10) EQ lsquoLIBLrsquo) THEN(ITERATE)ENDDO (group of CL commands)
SELECT Groupbull SELECT starts a ldquoconditionrdquo groupbull ENDSELECT ends group
bull Group must have at least one WHENndash WHEN command has COND and THEN parameters (like IF)bull OTHERWISE (optional) run if no WHEN COND = Truendash OTHERWISE command has only CMD parameter (like ELSE)bull Example
SELECTWHEN COND(ampTYPE EQ CMD) THEN(DO) hellip(group of CL commands)ENDDOWHEN COND(ampTYPE EQ PGM) THEN(DO) helliphellip(group of CL commands)ENDDOhellipOTHERWISE CMD(CHGVAR ampBADTYPE lsquo1rsquo)ENDSELECT
Enhanced File Support
Will support up to 5 file instances using DCLF
bull Instances can be for the same or different files
bull New OPNID (Open identifier) parameter added to
DCLF statement
bull Default for OPNID is NONE
ndashOnly one DCLF allowed with OPNID(NONE)
bull OPNID accepts simple name up to 10 characters
Enhanced File Support (continued)
If OPNID specified declared CL variables areprefixed by this name and an underscore (egampMYTESTFILE_CUSTNAME )bull OPNID added to existing file IO CL commandsndash RCVFndashENDRCVndash SNDFndashSNDRCVFndash WAIT
File variables Identifier qualification
DCLF FILE(STUDENTS) OPNID(STPF) DCLF FILE(STUDDF) OPNID(DSPF) DCL ampEOF LGL 1 CHGVAR ampEOF 0 RCVF OPNID(STPF) DOWHILE (NOT ampDSPF-IN03) CHGVAR ampDSPF-FINESOWED ampSTPF-FINESOWED IF COND(ampDSPF-FEESOWED GT ampSTPF-FEESOWED) +
THEN(CHGVAR ampDSPF-IN30 1) IF COND(ampDSPF-FINESOWED NE ampSTPF-FINESOWED) +
THEN(CHGVAR ampDSPF-IN31 1) SNDRCVF OPNID(DSPF) RCVF OPNID(STPF)
PGM
DCLF FILE(RADIO) RCDFMT(PROMPT) DCL VAR(ampLEN) TYPE(DEC) LEN(2) DCL VAR(ampOPTION) TYPE(CHAR) LEN(50) DCL VAR(ampDIV) TYPE(CHAR) LEN(10) CALLPRC PRC(ASSIGN2B) PARM(ampDIV ampOPTION)
Called program receiving passed parameters
PGM PARM(ampDIVI ampOPTI) DCL VAR(ampDIVI) TYPE(CHAR) LEN(10) DCL VAR(ampOPTI) TYPE(CHAR) LEN(50)
IF (ampDIVI EQ DIVISION2) THEN(DO) OVRDBF FILE(INFILE) TOFILE(QGPLCHAP8AS2) + MBR(DIVISION2) POSITION(START) SHARE(YES) ENDDO OPNQRYF FILE((INFILE)) QRYSLT(ampOPTI) + KEYFLD((EMPNO)) CPYFRMQRYF FROMOPNID(INFILE) TOFILE(QTEMPCHAP8AS2) + MBROPT(REPLACE) CRTFILE(YES)
And passing it further down the line to another program utility or tool
Passing parameters by valuebull CALLPRC (Call Procedure) command
supports calls from ILE CL procedures to other ILE procedures
bull In prior releases CALLPRC only supported passing parameters by reference
bull Can specify BYREF or BYVAL special valuefor each parameter being passed
bull Enables ILE CL to call many MI and C functions and other procedure APIs
bull Maximum numbers of parameters 300
- IBC233
- Agenda
- Slide 3
- Eyes FOCUS - where
- Using ldquoTYPE amp EDITINGrdquo to get what you want
- Lowercase in Display Files
- OPM Call (original program model)
- How it works
- ILE Call (Integrated Language Environment)
- Slide 10
- Slide 11
- Slide 12
- Slide 13
- Advantages of OPM
- Disadvantages of OPM
- Advantages of ILE
- Disadvantages of ILE
- DOWHILE Loop
- DOUNTIL Loop
- DOFOR Loop
- DOFOR Loop (continued)
- LEAVE and ITERATE
- SELECT Group
- Enhanced File Support
- Enhanced File Support (continued)
- File variables Identifier qualification
- Slide 27
- Passing parameters by value
-
Lowercase in Display Files
bull Data is usually stored in UPPERCASEndash Why
bull Check keywordndash Function CHECK(LC) Lower case allowed
ME Must enter
FE Field exit
required
etc
OPM Call(original program model)
bull CALLndash Parameters
PGM
PARM
How it works
bull When the call statement is executedYour authority to the program object is checked
Do you have access to all the resources required
Gather resources
Program opened
ILE Call(Integrated Language Environment)
bull CALLPRC
Parameters
PRC
PARM
RTNVAL
How it works
bull When the application is created authority to modules is checked and entire application is bound
bull When application is called
all resources are allocated
entire application is opened
PGM PARM(ampPROGRAM ampLIB ampSECTION) DCL VAR(ampPROGRAM) TYPE(CHAR) LEN(10) DCL VAR(ampLIB) TYPE(CHAR) LEN(10) DCL VAR(ampSECTION) TYPE(CHAR) LEN(1) DCLF FILE(ABERNSCBLSTLST) RCVF
Mixing variable types is possible but also very DANGEROUS Both calling and called program must be aware of the data type of each
variable else the dreaded MCH1202 error might occur
(switching between 8 and 4 bit mode ndash unpacked and packed data)
PGM PARM(ampSTUDENTNO ampPASSWORD) receives student +
number from CHKMRK command
DCL VAR(ampSTUDENTNO) TYPE(CHAR) LEN(9)
DCL VAR(ampPASSWORD ) TYPE(CHAR) LEN(10)
DCL VAR(ampJOBUSER) TYPE(CHAR) LEN(12)
COURSE-USERID SECTION ASGN PROF-USERID
CALL PGM(OA0CHKALL) PARM( DB233 E A1 ABERNS)
CALL PGM(OA0CHKALL) PARM( DB233 B A3 MCKENNA)
PGM PARM(ampCRSUSERID ampSECT ampLIBSUFFIX ampPROF)
PARMs Course UserID Section code Asgn + Lib suffix Profs Userid
DCL VAR(ampCRSUSERID) TYPE(CHAR) LEN(5) course + User Id eg DC324 DCL VAR(ampSECT) TYPE(CHAR) LEN(1) SECTION DCL VAR(ampLIBSUFFIX) TYPE(CHAR) LEN(2) DCL VAR(ampPROF) TYPE(CHAR) LEN(10) DCL VAR(ampUSERID) TYPE(CHAR) LEN(10) DCL VAR(ampUSERTXT) TYPE(CHAR) LEN(50)
CALLING
CALLED
Advantages of OPM
bull Donrsquot have to have all parts of the application done to test
bull Parts of the application can be changed without affecting the entire application
Disadvantages of OPM
bull Integrated Language not supported
Advantages of ILE
bull Integrated Language Supportndash Best language for the task
bull You donrsquot have to pass all parameters to the program ndash previous values will be used
Disadvantages of ILE
bull All modules must be in place to test application
bull Version Control
DOWHILE Loopbull DCL VAR(ampLGL) TYPE(LGL)CHECK IF COND(NOT ampLGL) THEN(GOTO DONE) (group of CL commands)GOTO CHECKDONE
bull New-style coding exampleEvaluates COND at top of loop
DOWHILE COND(ampLGL) (group of CL commands) 1048773 body will be run zero or more timesENDDO
DOUNTIL Loop bull Old style coding exampleDCL VAR(ampLGL) TYPE(LGL)LOOP (group of CL commands)IF COND(NOT ampLGL) THEN(GOTO LOOP)
bull New style coding exampleEvaluates COND at bottom of loop
DOUNTIL COND(ampLGL) (group of CL commands) 1048773 body will be run one or more timesENDDO
DOFOR Loopbull SyntaxDOFOR VAR( ) FROM( ) TO( ) BY( )bullbull VAR must be INT or UINT variablebull FROM and TO can be integer constants expressions or
variablesbull BY must be an integer constant (can be negative)
defaults to 1 other parameters are requiredbull FROMTO expressions are evaluated at loop initiation TOevaluated after increment
DOFOR Loop (continued)bull Old-style coding example
DCL ampLOOPCTL TYPE(DEC) LEN(5 0)DCL ampLOOPLMT TYPE(DEC) LEN(5 0)CHGVAR ampLOOPCTL VALUE(1)CHECK IF COND(ampLOOPCTL GT ampLOOPLMT) THEN(GOTO DONE) (group of CL commands)CHGVAR ampLOOPCTL VALUE(ampLOOPCTL+1)GOTO CHECKDONE
bull New-style coding exampleChecks for loop exit at top of loop (like DOWHILE)
DCL ampLOOPCTL TYPE(INT) LEN(4)DCL ampLOOPLMT TYPE(INT) LEN(4)DOFOR VAR(ampLOOPCTL) FROM(1) TO(ampLOOPLMT) BY(1) (group of CL commands) 1048773 body will be run zero or more timesENDDO
LEAVE and ITERATEbull Allowed only within a DOWHILE DOUNTIL or DOFOR group
bull LEAVE passes control to next CL statement following loop ENDDObull ITERATE passes control to end of loop and tests loop exit condition
bull Both support CMDLBL (Command label) parameter to allowjump out of multiple (nested) loopsndash Both default to CURRENT loopbull Example (group of CL commands)IF (SST(ampNAME 1 10) EQ lsquoNONErsquo) THEN(LEAVE LOOP1)ELSE (DO)IF (SST(ampNAME 11 10) EQ lsquoLIBLrsquo) THEN(ITERATE)ENDDO (group of CL commands)
SELECT Groupbull SELECT starts a ldquoconditionrdquo groupbull ENDSELECT ends group
bull Group must have at least one WHENndash WHEN command has COND and THEN parameters (like IF)bull OTHERWISE (optional) run if no WHEN COND = Truendash OTHERWISE command has only CMD parameter (like ELSE)bull Example
SELECTWHEN COND(ampTYPE EQ CMD) THEN(DO) hellip(group of CL commands)ENDDOWHEN COND(ampTYPE EQ PGM) THEN(DO) helliphellip(group of CL commands)ENDDOhellipOTHERWISE CMD(CHGVAR ampBADTYPE lsquo1rsquo)ENDSELECT
Enhanced File Support
Will support up to 5 file instances using DCLF
bull Instances can be for the same or different files
bull New OPNID (Open identifier) parameter added to
DCLF statement
bull Default for OPNID is NONE
ndashOnly one DCLF allowed with OPNID(NONE)
bull OPNID accepts simple name up to 10 characters
Enhanced File Support (continued)
If OPNID specified declared CL variables areprefixed by this name and an underscore (egampMYTESTFILE_CUSTNAME )bull OPNID added to existing file IO CL commandsndash RCVFndashENDRCVndash SNDFndashSNDRCVFndash WAIT
File variables Identifier qualification
DCLF FILE(STUDENTS) OPNID(STPF) DCLF FILE(STUDDF) OPNID(DSPF) DCL ampEOF LGL 1 CHGVAR ampEOF 0 RCVF OPNID(STPF) DOWHILE (NOT ampDSPF-IN03) CHGVAR ampDSPF-FINESOWED ampSTPF-FINESOWED IF COND(ampDSPF-FEESOWED GT ampSTPF-FEESOWED) +
THEN(CHGVAR ampDSPF-IN30 1) IF COND(ampDSPF-FINESOWED NE ampSTPF-FINESOWED) +
THEN(CHGVAR ampDSPF-IN31 1) SNDRCVF OPNID(DSPF) RCVF OPNID(STPF)
PGM
DCLF FILE(RADIO) RCDFMT(PROMPT) DCL VAR(ampLEN) TYPE(DEC) LEN(2) DCL VAR(ampOPTION) TYPE(CHAR) LEN(50) DCL VAR(ampDIV) TYPE(CHAR) LEN(10) CALLPRC PRC(ASSIGN2B) PARM(ampDIV ampOPTION)
Called program receiving passed parameters
PGM PARM(ampDIVI ampOPTI) DCL VAR(ampDIVI) TYPE(CHAR) LEN(10) DCL VAR(ampOPTI) TYPE(CHAR) LEN(50)
IF (ampDIVI EQ DIVISION2) THEN(DO) OVRDBF FILE(INFILE) TOFILE(QGPLCHAP8AS2) + MBR(DIVISION2) POSITION(START) SHARE(YES) ENDDO OPNQRYF FILE((INFILE)) QRYSLT(ampOPTI) + KEYFLD((EMPNO)) CPYFRMQRYF FROMOPNID(INFILE) TOFILE(QTEMPCHAP8AS2) + MBROPT(REPLACE) CRTFILE(YES)
And passing it further down the line to another program utility or tool
Passing parameters by valuebull CALLPRC (Call Procedure) command
supports calls from ILE CL procedures to other ILE procedures
bull In prior releases CALLPRC only supported passing parameters by reference
bull Can specify BYREF or BYVAL special valuefor each parameter being passed
bull Enables ILE CL to call many MI and C functions and other procedure APIs
bull Maximum numbers of parameters 300
- IBC233
- Agenda
- Slide 3
- Eyes FOCUS - where
- Using ldquoTYPE amp EDITINGrdquo to get what you want
- Lowercase in Display Files
- OPM Call (original program model)
- How it works
- ILE Call (Integrated Language Environment)
- Slide 10
- Slide 11
- Slide 12
- Slide 13
- Advantages of OPM
- Disadvantages of OPM
- Advantages of ILE
- Disadvantages of ILE
- DOWHILE Loop
- DOUNTIL Loop
- DOFOR Loop
- DOFOR Loop (continued)
- LEAVE and ITERATE
- SELECT Group
- Enhanced File Support
- Enhanced File Support (continued)
- File variables Identifier qualification
- Slide 27
- Passing parameters by value
-
OPM Call(original program model)
bull CALLndash Parameters
PGM
PARM
How it works
bull When the call statement is executedYour authority to the program object is checked
Do you have access to all the resources required
Gather resources
Program opened
ILE Call(Integrated Language Environment)
bull CALLPRC
Parameters
PRC
PARM
RTNVAL
How it works
bull When the application is created authority to modules is checked and entire application is bound
bull When application is called
all resources are allocated
entire application is opened
PGM PARM(ampPROGRAM ampLIB ampSECTION) DCL VAR(ampPROGRAM) TYPE(CHAR) LEN(10) DCL VAR(ampLIB) TYPE(CHAR) LEN(10) DCL VAR(ampSECTION) TYPE(CHAR) LEN(1) DCLF FILE(ABERNSCBLSTLST) RCVF
Mixing variable types is possible but also very DANGEROUS Both calling and called program must be aware of the data type of each
variable else the dreaded MCH1202 error might occur
(switching between 8 and 4 bit mode ndash unpacked and packed data)
PGM PARM(ampSTUDENTNO ampPASSWORD) receives student +
number from CHKMRK command
DCL VAR(ampSTUDENTNO) TYPE(CHAR) LEN(9)
DCL VAR(ampPASSWORD ) TYPE(CHAR) LEN(10)
DCL VAR(ampJOBUSER) TYPE(CHAR) LEN(12)
COURSE-USERID SECTION ASGN PROF-USERID
CALL PGM(OA0CHKALL) PARM( DB233 E A1 ABERNS)
CALL PGM(OA0CHKALL) PARM( DB233 B A3 MCKENNA)
PGM PARM(ampCRSUSERID ampSECT ampLIBSUFFIX ampPROF)
PARMs Course UserID Section code Asgn + Lib suffix Profs Userid
DCL VAR(ampCRSUSERID) TYPE(CHAR) LEN(5) course + User Id eg DC324 DCL VAR(ampSECT) TYPE(CHAR) LEN(1) SECTION DCL VAR(ampLIBSUFFIX) TYPE(CHAR) LEN(2) DCL VAR(ampPROF) TYPE(CHAR) LEN(10) DCL VAR(ampUSERID) TYPE(CHAR) LEN(10) DCL VAR(ampUSERTXT) TYPE(CHAR) LEN(50)
CALLING
CALLED
Advantages of OPM
bull Donrsquot have to have all parts of the application done to test
bull Parts of the application can be changed without affecting the entire application
Disadvantages of OPM
bull Integrated Language not supported
Advantages of ILE
bull Integrated Language Supportndash Best language for the task
bull You donrsquot have to pass all parameters to the program ndash previous values will be used
Disadvantages of ILE
bull All modules must be in place to test application
bull Version Control
DOWHILE Loopbull DCL VAR(ampLGL) TYPE(LGL)CHECK IF COND(NOT ampLGL) THEN(GOTO DONE) (group of CL commands)GOTO CHECKDONE
bull New-style coding exampleEvaluates COND at top of loop
DOWHILE COND(ampLGL) (group of CL commands) 1048773 body will be run zero or more timesENDDO
DOUNTIL Loop bull Old style coding exampleDCL VAR(ampLGL) TYPE(LGL)LOOP (group of CL commands)IF COND(NOT ampLGL) THEN(GOTO LOOP)
bull New style coding exampleEvaluates COND at bottom of loop
DOUNTIL COND(ampLGL) (group of CL commands) 1048773 body will be run one or more timesENDDO
DOFOR Loopbull SyntaxDOFOR VAR( ) FROM( ) TO( ) BY( )bullbull VAR must be INT or UINT variablebull FROM and TO can be integer constants expressions or
variablesbull BY must be an integer constant (can be negative)
defaults to 1 other parameters are requiredbull FROMTO expressions are evaluated at loop initiation TOevaluated after increment
DOFOR Loop (continued)bull Old-style coding example
DCL ampLOOPCTL TYPE(DEC) LEN(5 0)DCL ampLOOPLMT TYPE(DEC) LEN(5 0)CHGVAR ampLOOPCTL VALUE(1)CHECK IF COND(ampLOOPCTL GT ampLOOPLMT) THEN(GOTO DONE) (group of CL commands)CHGVAR ampLOOPCTL VALUE(ampLOOPCTL+1)GOTO CHECKDONE
bull New-style coding exampleChecks for loop exit at top of loop (like DOWHILE)
DCL ampLOOPCTL TYPE(INT) LEN(4)DCL ampLOOPLMT TYPE(INT) LEN(4)DOFOR VAR(ampLOOPCTL) FROM(1) TO(ampLOOPLMT) BY(1) (group of CL commands) 1048773 body will be run zero or more timesENDDO
LEAVE and ITERATEbull Allowed only within a DOWHILE DOUNTIL or DOFOR group
bull LEAVE passes control to next CL statement following loop ENDDObull ITERATE passes control to end of loop and tests loop exit condition
bull Both support CMDLBL (Command label) parameter to allowjump out of multiple (nested) loopsndash Both default to CURRENT loopbull Example (group of CL commands)IF (SST(ampNAME 1 10) EQ lsquoNONErsquo) THEN(LEAVE LOOP1)ELSE (DO)IF (SST(ampNAME 11 10) EQ lsquoLIBLrsquo) THEN(ITERATE)ENDDO (group of CL commands)
SELECT Groupbull SELECT starts a ldquoconditionrdquo groupbull ENDSELECT ends group
bull Group must have at least one WHENndash WHEN command has COND and THEN parameters (like IF)bull OTHERWISE (optional) run if no WHEN COND = Truendash OTHERWISE command has only CMD parameter (like ELSE)bull Example
SELECTWHEN COND(ampTYPE EQ CMD) THEN(DO) hellip(group of CL commands)ENDDOWHEN COND(ampTYPE EQ PGM) THEN(DO) helliphellip(group of CL commands)ENDDOhellipOTHERWISE CMD(CHGVAR ampBADTYPE lsquo1rsquo)ENDSELECT
Enhanced File Support
Will support up to 5 file instances using DCLF
bull Instances can be for the same or different files
bull New OPNID (Open identifier) parameter added to
DCLF statement
bull Default for OPNID is NONE
ndashOnly one DCLF allowed with OPNID(NONE)
bull OPNID accepts simple name up to 10 characters
Enhanced File Support (continued)
If OPNID specified declared CL variables areprefixed by this name and an underscore (egampMYTESTFILE_CUSTNAME )bull OPNID added to existing file IO CL commandsndash RCVFndashENDRCVndash SNDFndashSNDRCVFndash WAIT
File variables Identifier qualification
DCLF FILE(STUDENTS) OPNID(STPF) DCLF FILE(STUDDF) OPNID(DSPF) DCL ampEOF LGL 1 CHGVAR ampEOF 0 RCVF OPNID(STPF) DOWHILE (NOT ampDSPF-IN03) CHGVAR ampDSPF-FINESOWED ampSTPF-FINESOWED IF COND(ampDSPF-FEESOWED GT ampSTPF-FEESOWED) +
THEN(CHGVAR ampDSPF-IN30 1) IF COND(ampDSPF-FINESOWED NE ampSTPF-FINESOWED) +
THEN(CHGVAR ampDSPF-IN31 1) SNDRCVF OPNID(DSPF) RCVF OPNID(STPF)
PGM
DCLF FILE(RADIO) RCDFMT(PROMPT) DCL VAR(ampLEN) TYPE(DEC) LEN(2) DCL VAR(ampOPTION) TYPE(CHAR) LEN(50) DCL VAR(ampDIV) TYPE(CHAR) LEN(10) CALLPRC PRC(ASSIGN2B) PARM(ampDIV ampOPTION)
Called program receiving passed parameters
PGM PARM(ampDIVI ampOPTI) DCL VAR(ampDIVI) TYPE(CHAR) LEN(10) DCL VAR(ampOPTI) TYPE(CHAR) LEN(50)
IF (ampDIVI EQ DIVISION2) THEN(DO) OVRDBF FILE(INFILE) TOFILE(QGPLCHAP8AS2) + MBR(DIVISION2) POSITION(START) SHARE(YES) ENDDO OPNQRYF FILE((INFILE)) QRYSLT(ampOPTI) + KEYFLD((EMPNO)) CPYFRMQRYF FROMOPNID(INFILE) TOFILE(QTEMPCHAP8AS2) + MBROPT(REPLACE) CRTFILE(YES)
And passing it further down the line to another program utility or tool
Passing parameters by valuebull CALLPRC (Call Procedure) command
supports calls from ILE CL procedures to other ILE procedures
bull In prior releases CALLPRC only supported passing parameters by reference
bull Can specify BYREF or BYVAL special valuefor each parameter being passed
bull Enables ILE CL to call many MI and C functions and other procedure APIs
bull Maximum numbers of parameters 300
- IBC233
- Agenda
- Slide 3
- Eyes FOCUS - where
- Using ldquoTYPE amp EDITINGrdquo to get what you want
- Lowercase in Display Files
- OPM Call (original program model)
- How it works
- ILE Call (Integrated Language Environment)
- Slide 10
- Slide 11
- Slide 12
- Slide 13
- Advantages of OPM
- Disadvantages of OPM
- Advantages of ILE
- Disadvantages of ILE
- DOWHILE Loop
- DOUNTIL Loop
- DOFOR Loop
- DOFOR Loop (continued)
- LEAVE and ITERATE
- SELECT Group
- Enhanced File Support
- Enhanced File Support (continued)
- File variables Identifier qualification
- Slide 27
- Passing parameters by value
-
How it works
bull When the call statement is executedYour authority to the program object is checked
Do you have access to all the resources required
Gather resources
Program opened
ILE Call(Integrated Language Environment)
bull CALLPRC
Parameters
PRC
PARM
RTNVAL
How it works
bull When the application is created authority to modules is checked and entire application is bound
bull When application is called
all resources are allocated
entire application is opened
PGM PARM(ampPROGRAM ampLIB ampSECTION) DCL VAR(ampPROGRAM) TYPE(CHAR) LEN(10) DCL VAR(ampLIB) TYPE(CHAR) LEN(10) DCL VAR(ampSECTION) TYPE(CHAR) LEN(1) DCLF FILE(ABERNSCBLSTLST) RCVF
Mixing variable types is possible but also very DANGEROUS Both calling and called program must be aware of the data type of each
variable else the dreaded MCH1202 error might occur
(switching between 8 and 4 bit mode ndash unpacked and packed data)
PGM PARM(ampSTUDENTNO ampPASSWORD) receives student +
number from CHKMRK command
DCL VAR(ampSTUDENTNO) TYPE(CHAR) LEN(9)
DCL VAR(ampPASSWORD ) TYPE(CHAR) LEN(10)
DCL VAR(ampJOBUSER) TYPE(CHAR) LEN(12)
COURSE-USERID SECTION ASGN PROF-USERID
CALL PGM(OA0CHKALL) PARM( DB233 E A1 ABERNS)
CALL PGM(OA0CHKALL) PARM( DB233 B A3 MCKENNA)
PGM PARM(ampCRSUSERID ampSECT ampLIBSUFFIX ampPROF)
PARMs Course UserID Section code Asgn + Lib suffix Profs Userid
DCL VAR(ampCRSUSERID) TYPE(CHAR) LEN(5) course + User Id eg DC324 DCL VAR(ampSECT) TYPE(CHAR) LEN(1) SECTION DCL VAR(ampLIBSUFFIX) TYPE(CHAR) LEN(2) DCL VAR(ampPROF) TYPE(CHAR) LEN(10) DCL VAR(ampUSERID) TYPE(CHAR) LEN(10) DCL VAR(ampUSERTXT) TYPE(CHAR) LEN(50)
CALLING
CALLED
Advantages of OPM
bull Donrsquot have to have all parts of the application done to test
bull Parts of the application can be changed without affecting the entire application
Disadvantages of OPM
bull Integrated Language not supported
Advantages of ILE
bull Integrated Language Supportndash Best language for the task
bull You donrsquot have to pass all parameters to the program ndash previous values will be used
Disadvantages of ILE
bull All modules must be in place to test application
bull Version Control
DOWHILE Loopbull DCL VAR(ampLGL) TYPE(LGL)CHECK IF COND(NOT ampLGL) THEN(GOTO DONE) (group of CL commands)GOTO CHECKDONE
bull New-style coding exampleEvaluates COND at top of loop
DOWHILE COND(ampLGL) (group of CL commands) 1048773 body will be run zero or more timesENDDO
DOUNTIL Loop bull Old style coding exampleDCL VAR(ampLGL) TYPE(LGL)LOOP (group of CL commands)IF COND(NOT ampLGL) THEN(GOTO LOOP)
bull New style coding exampleEvaluates COND at bottom of loop
DOUNTIL COND(ampLGL) (group of CL commands) 1048773 body will be run one or more timesENDDO
DOFOR Loopbull SyntaxDOFOR VAR( ) FROM( ) TO( ) BY( )bullbull VAR must be INT or UINT variablebull FROM and TO can be integer constants expressions or
variablesbull BY must be an integer constant (can be negative)
defaults to 1 other parameters are requiredbull FROMTO expressions are evaluated at loop initiation TOevaluated after increment
DOFOR Loop (continued)bull Old-style coding example
DCL ampLOOPCTL TYPE(DEC) LEN(5 0)DCL ampLOOPLMT TYPE(DEC) LEN(5 0)CHGVAR ampLOOPCTL VALUE(1)CHECK IF COND(ampLOOPCTL GT ampLOOPLMT) THEN(GOTO DONE) (group of CL commands)CHGVAR ampLOOPCTL VALUE(ampLOOPCTL+1)GOTO CHECKDONE
bull New-style coding exampleChecks for loop exit at top of loop (like DOWHILE)
DCL ampLOOPCTL TYPE(INT) LEN(4)DCL ampLOOPLMT TYPE(INT) LEN(4)DOFOR VAR(ampLOOPCTL) FROM(1) TO(ampLOOPLMT) BY(1) (group of CL commands) 1048773 body will be run zero or more timesENDDO
LEAVE and ITERATEbull Allowed only within a DOWHILE DOUNTIL or DOFOR group
bull LEAVE passes control to next CL statement following loop ENDDObull ITERATE passes control to end of loop and tests loop exit condition
bull Both support CMDLBL (Command label) parameter to allowjump out of multiple (nested) loopsndash Both default to CURRENT loopbull Example (group of CL commands)IF (SST(ampNAME 1 10) EQ lsquoNONErsquo) THEN(LEAVE LOOP1)ELSE (DO)IF (SST(ampNAME 11 10) EQ lsquoLIBLrsquo) THEN(ITERATE)ENDDO (group of CL commands)
SELECT Groupbull SELECT starts a ldquoconditionrdquo groupbull ENDSELECT ends group
bull Group must have at least one WHENndash WHEN command has COND and THEN parameters (like IF)bull OTHERWISE (optional) run if no WHEN COND = Truendash OTHERWISE command has only CMD parameter (like ELSE)bull Example
SELECTWHEN COND(ampTYPE EQ CMD) THEN(DO) hellip(group of CL commands)ENDDOWHEN COND(ampTYPE EQ PGM) THEN(DO) helliphellip(group of CL commands)ENDDOhellipOTHERWISE CMD(CHGVAR ampBADTYPE lsquo1rsquo)ENDSELECT
Enhanced File Support
Will support up to 5 file instances using DCLF
bull Instances can be for the same or different files
bull New OPNID (Open identifier) parameter added to
DCLF statement
bull Default for OPNID is NONE
ndashOnly one DCLF allowed with OPNID(NONE)
bull OPNID accepts simple name up to 10 characters
Enhanced File Support (continued)
If OPNID specified declared CL variables areprefixed by this name and an underscore (egampMYTESTFILE_CUSTNAME )bull OPNID added to existing file IO CL commandsndash RCVFndashENDRCVndash SNDFndashSNDRCVFndash WAIT
File variables Identifier qualification
DCLF FILE(STUDENTS) OPNID(STPF) DCLF FILE(STUDDF) OPNID(DSPF) DCL ampEOF LGL 1 CHGVAR ampEOF 0 RCVF OPNID(STPF) DOWHILE (NOT ampDSPF-IN03) CHGVAR ampDSPF-FINESOWED ampSTPF-FINESOWED IF COND(ampDSPF-FEESOWED GT ampSTPF-FEESOWED) +
THEN(CHGVAR ampDSPF-IN30 1) IF COND(ampDSPF-FINESOWED NE ampSTPF-FINESOWED) +
THEN(CHGVAR ampDSPF-IN31 1) SNDRCVF OPNID(DSPF) RCVF OPNID(STPF)
PGM
DCLF FILE(RADIO) RCDFMT(PROMPT) DCL VAR(ampLEN) TYPE(DEC) LEN(2) DCL VAR(ampOPTION) TYPE(CHAR) LEN(50) DCL VAR(ampDIV) TYPE(CHAR) LEN(10) CALLPRC PRC(ASSIGN2B) PARM(ampDIV ampOPTION)
Called program receiving passed parameters
PGM PARM(ampDIVI ampOPTI) DCL VAR(ampDIVI) TYPE(CHAR) LEN(10) DCL VAR(ampOPTI) TYPE(CHAR) LEN(50)
IF (ampDIVI EQ DIVISION2) THEN(DO) OVRDBF FILE(INFILE) TOFILE(QGPLCHAP8AS2) + MBR(DIVISION2) POSITION(START) SHARE(YES) ENDDO OPNQRYF FILE((INFILE)) QRYSLT(ampOPTI) + KEYFLD((EMPNO)) CPYFRMQRYF FROMOPNID(INFILE) TOFILE(QTEMPCHAP8AS2) + MBROPT(REPLACE) CRTFILE(YES)
And passing it further down the line to another program utility or tool
Passing parameters by valuebull CALLPRC (Call Procedure) command
supports calls from ILE CL procedures to other ILE procedures
bull In prior releases CALLPRC only supported passing parameters by reference
bull Can specify BYREF or BYVAL special valuefor each parameter being passed
bull Enables ILE CL to call many MI and C functions and other procedure APIs
bull Maximum numbers of parameters 300
- IBC233
- Agenda
- Slide 3
- Eyes FOCUS - where
- Using ldquoTYPE amp EDITINGrdquo to get what you want
- Lowercase in Display Files
- OPM Call (original program model)
- How it works
- ILE Call (Integrated Language Environment)
- Slide 10
- Slide 11
- Slide 12
- Slide 13
- Advantages of OPM
- Disadvantages of OPM
- Advantages of ILE
- Disadvantages of ILE
- DOWHILE Loop
- DOUNTIL Loop
- DOFOR Loop
- DOFOR Loop (continued)
- LEAVE and ITERATE
- SELECT Group
- Enhanced File Support
- Enhanced File Support (continued)
- File variables Identifier qualification
- Slide 27
- Passing parameters by value
-
ILE Call(Integrated Language Environment)
bull CALLPRC
Parameters
PRC
PARM
RTNVAL
How it works
bull When the application is created authority to modules is checked and entire application is bound
bull When application is called
all resources are allocated
entire application is opened
PGM PARM(ampPROGRAM ampLIB ampSECTION) DCL VAR(ampPROGRAM) TYPE(CHAR) LEN(10) DCL VAR(ampLIB) TYPE(CHAR) LEN(10) DCL VAR(ampSECTION) TYPE(CHAR) LEN(1) DCLF FILE(ABERNSCBLSTLST) RCVF
Mixing variable types is possible but also very DANGEROUS Both calling and called program must be aware of the data type of each
variable else the dreaded MCH1202 error might occur
(switching between 8 and 4 bit mode ndash unpacked and packed data)
PGM PARM(ampSTUDENTNO ampPASSWORD) receives student +
number from CHKMRK command
DCL VAR(ampSTUDENTNO) TYPE(CHAR) LEN(9)
DCL VAR(ampPASSWORD ) TYPE(CHAR) LEN(10)
DCL VAR(ampJOBUSER) TYPE(CHAR) LEN(12)
COURSE-USERID SECTION ASGN PROF-USERID
CALL PGM(OA0CHKALL) PARM( DB233 E A1 ABERNS)
CALL PGM(OA0CHKALL) PARM( DB233 B A3 MCKENNA)
PGM PARM(ampCRSUSERID ampSECT ampLIBSUFFIX ampPROF)
PARMs Course UserID Section code Asgn + Lib suffix Profs Userid
DCL VAR(ampCRSUSERID) TYPE(CHAR) LEN(5) course + User Id eg DC324 DCL VAR(ampSECT) TYPE(CHAR) LEN(1) SECTION DCL VAR(ampLIBSUFFIX) TYPE(CHAR) LEN(2) DCL VAR(ampPROF) TYPE(CHAR) LEN(10) DCL VAR(ampUSERID) TYPE(CHAR) LEN(10) DCL VAR(ampUSERTXT) TYPE(CHAR) LEN(50)
CALLING
CALLED
Advantages of OPM
bull Donrsquot have to have all parts of the application done to test
bull Parts of the application can be changed without affecting the entire application
Disadvantages of OPM
bull Integrated Language not supported
Advantages of ILE
bull Integrated Language Supportndash Best language for the task
bull You donrsquot have to pass all parameters to the program ndash previous values will be used
Disadvantages of ILE
bull All modules must be in place to test application
bull Version Control
DOWHILE Loopbull DCL VAR(ampLGL) TYPE(LGL)CHECK IF COND(NOT ampLGL) THEN(GOTO DONE) (group of CL commands)GOTO CHECKDONE
bull New-style coding exampleEvaluates COND at top of loop
DOWHILE COND(ampLGL) (group of CL commands) 1048773 body will be run zero or more timesENDDO
DOUNTIL Loop bull Old style coding exampleDCL VAR(ampLGL) TYPE(LGL)LOOP (group of CL commands)IF COND(NOT ampLGL) THEN(GOTO LOOP)
bull New style coding exampleEvaluates COND at bottom of loop
DOUNTIL COND(ampLGL) (group of CL commands) 1048773 body will be run one or more timesENDDO
DOFOR Loopbull SyntaxDOFOR VAR( ) FROM( ) TO( ) BY( )bullbull VAR must be INT or UINT variablebull FROM and TO can be integer constants expressions or
variablesbull BY must be an integer constant (can be negative)
defaults to 1 other parameters are requiredbull FROMTO expressions are evaluated at loop initiation TOevaluated after increment
DOFOR Loop (continued)bull Old-style coding example
DCL ampLOOPCTL TYPE(DEC) LEN(5 0)DCL ampLOOPLMT TYPE(DEC) LEN(5 0)CHGVAR ampLOOPCTL VALUE(1)CHECK IF COND(ampLOOPCTL GT ampLOOPLMT) THEN(GOTO DONE) (group of CL commands)CHGVAR ampLOOPCTL VALUE(ampLOOPCTL+1)GOTO CHECKDONE
bull New-style coding exampleChecks for loop exit at top of loop (like DOWHILE)
DCL ampLOOPCTL TYPE(INT) LEN(4)DCL ampLOOPLMT TYPE(INT) LEN(4)DOFOR VAR(ampLOOPCTL) FROM(1) TO(ampLOOPLMT) BY(1) (group of CL commands) 1048773 body will be run zero or more timesENDDO
LEAVE and ITERATEbull Allowed only within a DOWHILE DOUNTIL or DOFOR group
bull LEAVE passes control to next CL statement following loop ENDDObull ITERATE passes control to end of loop and tests loop exit condition
bull Both support CMDLBL (Command label) parameter to allowjump out of multiple (nested) loopsndash Both default to CURRENT loopbull Example (group of CL commands)IF (SST(ampNAME 1 10) EQ lsquoNONErsquo) THEN(LEAVE LOOP1)ELSE (DO)IF (SST(ampNAME 11 10) EQ lsquoLIBLrsquo) THEN(ITERATE)ENDDO (group of CL commands)
SELECT Groupbull SELECT starts a ldquoconditionrdquo groupbull ENDSELECT ends group
bull Group must have at least one WHENndash WHEN command has COND and THEN parameters (like IF)bull OTHERWISE (optional) run if no WHEN COND = Truendash OTHERWISE command has only CMD parameter (like ELSE)bull Example
SELECTWHEN COND(ampTYPE EQ CMD) THEN(DO) hellip(group of CL commands)ENDDOWHEN COND(ampTYPE EQ PGM) THEN(DO) helliphellip(group of CL commands)ENDDOhellipOTHERWISE CMD(CHGVAR ampBADTYPE lsquo1rsquo)ENDSELECT
Enhanced File Support
Will support up to 5 file instances using DCLF
bull Instances can be for the same or different files
bull New OPNID (Open identifier) parameter added to
DCLF statement
bull Default for OPNID is NONE
ndashOnly one DCLF allowed with OPNID(NONE)
bull OPNID accepts simple name up to 10 characters
Enhanced File Support (continued)
If OPNID specified declared CL variables areprefixed by this name and an underscore (egampMYTESTFILE_CUSTNAME )bull OPNID added to existing file IO CL commandsndash RCVFndashENDRCVndash SNDFndashSNDRCVFndash WAIT
File variables Identifier qualification
DCLF FILE(STUDENTS) OPNID(STPF) DCLF FILE(STUDDF) OPNID(DSPF) DCL ampEOF LGL 1 CHGVAR ampEOF 0 RCVF OPNID(STPF) DOWHILE (NOT ampDSPF-IN03) CHGVAR ampDSPF-FINESOWED ampSTPF-FINESOWED IF COND(ampDSPF-FEESOWED GT ampSTPF-FEESOWED) +
THEN(CHGVAR ampDSPF-IN30 1) IF COND(ampDSPF-FINESOWED NE ampSTPF-FINESOWED) +
THEN(CHGVAR ampDSPF-IN31 1) SNDRCVF OPNID(DSPF) RCVF OPNID(STPF)
PGM
DCLF FILE(RADIO) RCDFMT(PROMPT) DCL VAR(ampLEN) TYPE(DEC) LEN(2) DCL VAR(ampOPTION) TYPE(CHAR) LEN(50) DCL VAR(ampDIV) TYPE(CHAR) LEN(10) CALLPRC PRC(ASSIGN2B) PARM(ampDIV ampOPTION)
Called program receiving passed parameters
PGM PARM(ampDIVI ampOPTI) DCL VAR(ampDIVI) TYPE(CHAR) LEN(10) DCL VAR(ampOPTI) TYPE(CHAR) LEN(50)
IF (ampDIVI EQ DIVISION2) THEN(DO) OVRDBF FILE(INFILE) TOFILE(QGPLCHAP8AS2) + MBR(DIVISION2) POSITION(START) SHARE(YES) ENDDO OPNQRYF FILE((INFILE)) QRYSLT(ampOPTI) + KEYFLD((EMPNO)) CPYFRMQRYF FROMOPNID(INFILE) TOFILE(QTEMPCHAP8AS2) + MBROPT(REPLACE) CRTFILE(YES)
And passing it further down the line to another program utility or tool
Passing parameters by valuebull CALLPRC (Call Procedure) command
supports calls from ILE CL procedures to other ILE procedures
bull In prior releases CALLPRC only supported passing parameters by reference
bull Can specify BYREF or BYVAL special valuefor each parameter being passed
bull Enables ILE CL to call many MI and C functions and other procedure APIs
bull Maximum numbers of parameters 300
- IBC233
- Agenda
- Slide 3
- Eyes FOCUS - where
- Using ldquoTYPE amp EDITINGrdquo to get what you want
- Lowercase in Display Files
- OPM Call (original program model)
- How it works
- ILE Call (Integrated Language Environment)
- Slide 10
- Slide 11
- Slide 12
- Slide 13
- Advantages of OPM
- Disadvantages of OPM
- Advantages of ILE
- Disadvantages of ILE
- DOWHILE Loop
- DOUNTIL Loop
- DOFOR Loop
- DOFOR Loop (continued)
- LEAVE and ITERATE
- SELECT Group
- Enhanced File Support
- Enhanced File Support (continued)
- File variables Identifier qualification
- Slide 27
- Passing parameters by value
-
How it works
bull When the application is created authority to modules is checked and entire application is bound
bull When application is called
all resources are allocated
entire application is opened
PGM PARM(ampPROGRAM ampLIB ampSECTION) DCL VAR(ampPROGRAM) TYPE(CHAR) LEN(10) DCL VAR(ampLIB) TYPE(CHAR) LEN(10) DCL VAR(ampSECTION) TYPE(CHAR) LEN(1) DCLF FILE(ABERNSCBLSTLST) RCVF
Mixing variable types is possible but also very DANGEROUS Both calling and called program must be aware of the data type of each
variable else the dreaded MCH1202 error might occur
(switching between 8 and 4 bit mode ndash unpacked and packed data)
PGM PARM(ampSTUDENTNO ampPASSWORD) receives student +
number from CHKMRK command
DCL VAR(ampSTUDENTNO) TYPE(CHAR) LEN(9)
DCL VAR(ampPASSWORD ) TYPE(CHAR) LEN(10)
DCL VAR(ampJOBUSER) TYPE(CHAR) LEN(12)
COURSE-USERID SECTION ASGN PROF-USERID
CALL PGM(OA0CHKALL) PARM( DB233 E A1 ABERNS)
CALL PGM(OA0CHKALL) PARM( DB233 B A3 MCKENNA)
PGM PARM(ampCRSUSERID ampSECT ampLIBSUFFIX ampPROF)
PARMs Course UserID Section code Asgn + Lib suffix Profs Userid
DCL VAR(ampCRSUSERID) TYPE(CHAR) LEN(5) course + User Id eg DC324 DCL VAR(ampSECT) TYPE(CHAR) LEN(1) SECTION DCL VAR(ampLIBSUFFIX) TYPE(CHAR) LEN(2) DCL VAR(ampPROF) TYPE(CHAR) LEN(10) DCL VAR(ampUSERID) TYPE(CHAR) LEN(10) DCL VAR(ampUSERTXT) TYPE(CHAR) LEN(50)
CALLING
CALLED
Advantages of OPM
bull Donrsquot have to have all parts of the application done to test
bull Parts of the application can be changed without affecting the entire application
Disadvantages of OPM
bull Integrated Language not supported
Advantages of ILE
bull Integrated Language Supportndash Best language for the task
bull You donrsquot have to pass all parameters to the program ndash previous values will be used
Disadvantages of ILE
bull All modules must be in place to test application
bull Version Control
DOWHILE Loopbull DCL VAR(ampLGL) TYPE(LGL)CHECK IF COND(NOT ampLGL) THEN(GOTO DONE) (group of CL commands)GOTO CHECKDONE
bull New-style coding exampleEvaluates COND at top of loop
DOWHILE COND(ampLGL) (group of CL commands) 1048773 body will be run zero or more timesENDDO
DOUNTIL Loop bull Old style coding exampleDCL VAR(ampLGL) TYPE(LGL)LOOP (group of CL commands)IF COND(NOT ampLGL) THEN(GOTO LOOP)
bull New style coding exampleEvaluates COND at bottom of loop
DOUNTIL COND(ampLGL) (group of CL commands) 1048773 body will be run one or more timesENDDO
DOFOR Loopbull SyntaxDOFOR VAR( ) FROM( ) TO( ) BY( )bullbull VAR must be INT or UINT variablebull FROM and TO can be integer constants expressions or
variablesbull BY must be an integer constant (can be negative)
defaults to 1 other parameters are requiredbull FROMTO expressions are evaluated at loop initiation TOevaluated after increment
DOFOR Loop (continued)bull Old-style coding example
DCL ampLOOPCTL TYPE(DEC) LEN(5 0)DCL ampLOOPLMT TYPE(DEC) LEN(5 0)CHGVAR ampLOOPCTL VALUE(1)CHECK IF COND(ampLOOPCTL GT ampLOOPLMT) THEN(GOTO DONE) (group of CL commands)CHGVAR ampLOOPCTL VALUE(ampLOOPCTL+1)GOTO CHECKDONE
bull New-style coding exampleChecks for loop exit at top of loop (like DOWHILE)
DCL ampLOOPCTL TYPE(INT) LEN(4)DCL ampLOOPLMT TYPE(INT) LEN(4)DOFOR VAR(ampLOOPCTL) FROM(1) TO(ampLOOPLMT) BY(1) (group of CL commands) 1048773 body will be run zero or more timesENDDO
LEAVE and ITERATEbull Allowed only within a DOWHILE DOUNTIL or DOFOR group
bull LEAVE passes control to next CL statement following loop ENDDObull ITERATE passes control to end of loop and tests loop exit condition
bull Both support CMDLBL (Command label) parameter to allowjump out of multiple (nested) loopsndash Both default to CURRENT loopbull Example (group of CL commands)IF (SST(ampNAME 1 10) EQ lsquoNONErsquo) THEN(LEAVE LOOP1)ELSE (DO)IF (SST(ampNAME 11 10) EQ lsquoLIBLrsquo) THEN(ITERATE)ENDDO (group of CL commands)
SELECT Groupbull SELECT starts a ldquoconditionrdquo groupbull ENDSELECT ends group
bull Group must have at least one WHENndash WHEN command has COND and THEN parameters (like IF)bull OTHERWISE (optional) run if no WHEN COND = Truendash OTHERWISE command has only CMD parameter (like ELSE)bull Example
SELECTWHEN COND(ampTYPE EQ CMD) THEN(DO) hellip(group of CL commands)ENDDOWHEN COND(ampTYPE EQ PGM) THEN(DO) helliphellip(group of CL commands)ENDDOhellipOTHERWISE CMD(CHGVAR ampBADTYPE lsquo1rsquo)ENDSELECT
Enhanced File Support
Will support up to 5 file instances using DCLF
bull Instances can be for the same or different files
bull New OPNID (Open identifier) parameter added to
DCLF statement
bull Default for OPNID is NONE
ndashOnly one DCLF allowed with OPNID(NONE)
bull OPNID accepts simple name up to 10 characters
Enhanced File Support (continued)
If OPNID specified declared CL variables areprefixed by this name and an underscore (egampMYTESTFILE_CUSTNAME )bull OPNID added to existing file IO CL commandsndash RCVFndashENDRCVndash SNDFndashSNDRCVFndash WAIT
File variables Identifier qualification
DCLF FILE(STUDENTS) OPNID(STPF) DCLF FILE(STUDDF) OPNID(DSPF) DCL ampEOF LGL 1 CHGVAR ampEOF 0 RCVF OPNID(STPF) DOWHILE (NOT ampDSPF-IN03) CHGVAR ampDSPF-FINESOWED ampSTPF-FINESOWED IF COND(ampDSPF-FEESOWED GT ampSTPF-FEESOWED) +
THEN(CHGVAR ampDSPF-IN30 1) IF COND(ampDSPF-FINESOWED NE ampSTPF-FINESOWED) +
THEN(CHGVAR ampDSPF-IN31 1) SNDRCVF OPNID(DSPF) RCVF OPNID(STPF)
PGM
DCLF FILE(RADIO) RCDFMT(PROMPT) DCL VAR(ampLEN) TYPE(DEC) LEN(2) DCL VAR(ampOPTION) TYPE(CHAR) LEN(50) DCL VAR(ampDIV) TYPE(CHAR) LEN(10) CALLPRC PRC(ASSIGN2B) PARM(ampDIV ampOPTION)
Called program receiving passed parameters
PGM PARM(ampDIVI ampOPTI) DCL VAR(ampDIVI) TYPE(CHAR) LEN(10) DCL VAR(ampOPTI) TYPE(CHAR) LEN(50)
IF (ampDIVI EQ DIVISION2) THEN(DO) OVRDBF FILE(INFILE) TOFILE(QGPLCHAP8AS2) + MBR(DIVISION2) POSITION(START) SHARE(YES) ENDDO OPNQRYF FILE((INFILE)) QRYSLT(ampOPTI) + KEYFLD((EMPNO)) CPYFRMQRYF FROMOPNID(INFILE) TOFILE(QTEMPCHAP8AS2) + MBROPT(REPLACE) CRTFILE(YES)
And passing it further down the line to another program utility or tool
Passing parameters by valuebull CALLPRC (Call Procedure) command
supports calls from ILE CL procedures to other ILE procedures
bull In prior releases CALLPRC only supported passing parameters by reference
bull Can specify BYREF or BYVAL special valuefor each parameter being passed
bull Enables ILE CL to call many MI and C functions and other procedure APIs
bull Maximum numbers of parameters 300
- IBC233
- Agenda
- Slide 3
- Eyes FOCUS - where
- Using ldquoTYPE amp EDITINGrdquo to get what you want
- Lowercase in Display Files
- OPM Call (original program model)
- How it works
- ILE Call (Integrated Language Environment)
- Slide 10
- Slide 11
- Slide 12
- Slide 13
- Advantages of OPM
- Disadvantages of OPM
- Advantages of ILE
- Disadvantages of ILE
- DOWHILE Loop
- DOUNTIL Loop
- DOFOR Loop
- DOFOR Loop (continued)
- LEAVE and ITERATE
- SELECT Group
- Enhanced File Support
- Enhanced File Support (continued)
- File variables Identifier qualification
- Slide 27
- Passing parameters by value
-
PGM PARM(ampPROGRAM ampLIB ampSECTION) DCL VAR(ampPROGRAM) TYPE(CHAR) LEN(10) DCL VAR(ampLIB) TYPE(CHAR) LEN(10) DCL VAR(ampSECTION) TYPE(CHAR) LEN(1) DCLF FILE(ABERNSCBLSTLST) RCVF
Mixing variable types is possible but also very DANGEROUS Both calling and called program must be aware of the data type of each
variable else the dreaded MCH1202 error might occur
(switching between 8 and 4 bit mode ndash unpacked and packed data)
PGM PARM(ampSTUDENTNO ampPASSWORD) receives student +
number from CHKMRK command
DCL VAR(ampSTUDENTNO) TYPE(CHAR) LEN(9)
DCL VAR(ampPASSWORD ) TYPE(CHAR) LEN(10)
DCL VAR(ampJOBUSER) TYPE(CHAR) LEN(12)
COURSE-USERID SECTION ASGN PROF-USERID
CALL PGM(OA0CHKALL) PARM( DB233 E A1 ABERNS)
CALL PGM(OA0CHKALL) PARM( DB233 B A3 MCKENNA)
PGM PARM(ampCRSUSERID ampSECT ampLIBSUFFIX ampPROF)
PARMs Course UserID Section code Asgn + Lib suffix Profs Userid
DCL VAR(ampCRSUSERID) TYPE(CHAR) LEN(5) course + User Id eg DC324 DCL VAR(ampSECT) TYPE(CHAR) LEN(1) SECTION DCL VAR(ampLIBSUFFIX) TYPE(CHAR) LEN(2) DCL VAR(ampPROF) TYPE(CHAR) LEN(10) DCL VAR(ampUSERID) TYPE(CHAR) LEN(10) DCL VAR(ampUSERTXT) TYPE(CHAR) LEN(50)
CALLING
CALLED
Advantages of OPM
bull Donrsquot have to have all parts of the application done to test
bull Parts of the application can be changed without affecting the entire application
Disadvantages of OPM
bull Integrated Language not supported
Advantages of ILE
bull Integrated Language Supportndash Best language for the task
bull You donrsquot have to pass all parameters to the program ndash previous values will be used
Disadvantages of ILE
bull All modules must be in place to test application
bull Version Control
DOWHILE Loopbull DCL VAR(ampLGL) TYPE(LGL)CHECK IF COND(NOT ampLGL) THEN(GOTO DONE) (group of CL commands)GOTO CHECKDONE
bull New-style coding exampleEvaluates COND at top of loop
DOWHILE COND(ampLGL) (group of CL commands) 1048773 body will be run zero or more timesENDDO
DOUNTIL Loop bull Old style coding exampleDCL VAR(ampLGL) TYPE(LGL)LOOP (group of CL commands)IF COND(NOT ampLGL) THEN(GOTO LOOP)
bull New style coding exampleEvaluates COND at bottom of loop
DOUNTIL COND(ampLGL) (group of CL commands) 1048773 body will be run one or more timesENDDO
DOFOR Loopbull SyntaxDOFOR VAR( ) FROM( ) TO( ) BY( )bullbull VAR must be INT or UINT variablebull FROM and TO can be integer constants expressions or
variablesbull BY must be an integer constant (can be negative)
defaults to 1 other parameters are requiredbull FROMTO expressions are evaluated at loop initiation TOevaluated after increment
DOFOR Loop (continued)bull Old-style coding example
DCL ampLOOPCTL TYPE(DEC) LEN(5 0)DCL ampLOOPLMT TYPE(DEC) LEN(5 0)CHGVAR ampLOOPCTL VALUE(1)CHECK IF COND(ampLOOPCTL GT ampLOOPLMT) THEN(GOTO DONE) (group of CL commands)CHGVAR ampLOOPCTL VALUE(ampLOOPCTL+1)GOTO CHECKDONE
bull New-style coding exampleChecks for loop exit at top of loop (like DOWHILE)
DCL ampLOOPCTL TYPE(INT) LEN(4)DCL ampLOOPLMT TYPE(INT) LEN(4)DOFOR VAR(ampLOOPCTL) FROM(1) TO(ampLOOPLMT) BY(1) (group of CL commands) 1048773 body will be run zero or more timesENDDO
LEAVE and ITERATEbull Allowed only within a DOWHILE DOUNTIL or DOFOR group
bull LEAVE passes control to next CL statement following loop ENDDObull ITERATE passes control to end of loop and tests loop exit condition
bull Both support CMDLBL (Command label) parameter to allowjump out of multiple (nested) loopsndash Both default to CURRENT loopbull Example (group of CL commands)IF (SST(ampNAME 1 10) EQ lsquoNONErsquo) THEN(LEAVE LOOP1)ELSE (DO)IF (SST(ampNAME 11 10) EQ lsquoLIBLrsquo) THEN(ITERATE)ENDDO (group of CL commands)
SELECT Groupbull SELECT starts a ldquoconditionrdquo groupbull ENDSELECT ends group
bull Group must have at least one WHENndash WHEN command has COND and THEN parameters (like IF)bull OTHERWISE (optional) run if no WHEN COND = Truendash OTHERWISE command has only CMD parameter (like ELSE)bull Example
SELECTWHEN COND(ampTYPE EQ CMD) THEN(DO) hellip(group of CL commands)ENDDOWHEN COND(ampTYPE EQ PGM) THEN(DO) helliphellip(group of CL commands)ENDDOhellipOTHERWISE CMD(CHGVAR ampBADTYPE lsquo1rsquo)ENDSELECT
Enhanced File Support
Will support up to 5 file instances using DCLF
bull Instances can be for the same or different files
bull New OPNID (Open identifier) parameter added to
DCLF statement
bull Default for OPNID is NONE
ndashOnly one DCLF allowed with OPNID(NONE)
bull OPNID accepts simple name up to 10 characters
Enhanced File Support (continued)
If OPNID specified declared CL variables areprefixed by this name and an underscore (egampMYTESTFILE_CUSTNAME )bull OPNID added to existing file IO CL commandsndash RCVFndashENDRCVndash SNDFndashSNDRCVFndash WAIT
File variables Identifier qualification
DCLF FILE(STUDENTS) OPNID(STPF) DCLF FILE(STUDDF) OPNID(DSPF) DCL ampEOF LGL 1 CHGVAR ampEOF 0 RCVF OPNID(STPF) DOWHILE (NOT ampDSPF-IN03) CHGVAR ampDSPF-FINESOWED ampSTPF-FINESOWED IF COND(ampDSPF-FEESOWED GT ampSTPF-FEESOWED) +
THEN(CHGVAR ampDSPF-IN30 1) IF COND(ampDSPF-FINESOWED NE ampSTPF-FINESOWED) +
THEN(CHGVAR ampDSPF-IN31 1) SNDRCVF OPNID(DSPF) RCVF OPNID(STPF)
PGM
DCLF FILE(RADIO) RCDFMT(PROMPT) DCL VAR(ampLEN) TYPE(DEC) LEN(2) DCL VAR(ampOPTION) TYPE(CHAR) LEN(50) DCL VAR(ampDIV) TYPE(CHAR) LEN(10) CALLPRC PRC(ASSIGN2B) PARM(ampDIV ampOPTION)
Called program receiving passed parameters
PGM PARM(ampDIVI ampOPTI) DCL VAR(ampDIVI) TYPE(CHAR) LEN(10) DCL VAR(ampOPTI) TYPE(CHAR) LEN(50)
IF (ampDIVI EQ DIVISION2) THEN(DO) OVRDBF FILE(INFILE) TOFILE(QGPLCHAP8AS2) + MBR(DIVISION2) POSITION(START) SHARE(YES) ENDDO OPNQRYF FILE((INFILE)) QRYSLT(ampOPTI) + KEYFLD((EMPNO)) CPYFRMQRYF FROMOPNID(INFILE) TOFILE(QTEMPCHAP8AS2) + MBROPT(REPLACE) CRTFILE(YES)
And passing it further down the line to another program utility or tool
Passing parameters by valuebull CALLPRC (Call Procedure) command
supports calls from ILE CL procedures to other ILE procedures
bull In prior releases CALLPRC only supported passing parameters by reference
bull Can specify BYREF or BYVAL special valuefor each parameter being passed
bull Enables ILE CL to call many MI and C functions and other procedure APIs
bull Maximum numbers of parameters 300
- IBC233
- Agenda
- Slide 3
- Eyes FOCUS - where
- Using ldquoTYPE amp EDITINGrdquo to get what you want
- Lowercase in Display Files
- OPM Call (original program model)
- How it works
- ILE Call (Integrated Language Environment)
- Slide 10
- Slide 11
- Slide 12
- Slide 13
- Advantages of OPM
- Disadvantages of OPM
- Advantages of ILE
- Disadvantages of ILE
- DOWHILE Loop
- DOUNTIL Loop
- DOFOR Loop
- DOFOR Loop (continued)
- LEAVE and ITERATE
- SELECT Group
- Enhanced File Support
- Enhanced File Support (continued)
- File variables Identifier qualification
- Slide 27
- Passing parameters by value
-
PGM PARM(ampSTUDENTNO ampPASSWORD) receives student +
number from CHKMRK command
DCL VAR(ampSTUDENTNO) TYPE(CHAR) LEN(9)
DCL VAR(ampPASSWORD ) TYPE(CHAR) LEN(10)
DCL VAR(ampJOBUSER) TYPE(CHAR) LEN(12)
COURSE-USERID SECTION ASGN PROF-USERID
CALL PGM(OA0CHKALL) PARM( DB233 E A1 ABERNS)
CALL PGM(OA0CHKALL) PARM( DB233 B A3 MCKENNA)
PGM PARM(ampCRSUSERID ampSECT ampLIBSUFFIX ampPROF)
PARMs Course UserID Section code Asgn + Lib suffix Profs Userid
DCL VAR(ampCRSUSERID) TYPE(CHAR) LEN(5) course + User Id eg DC324 DCL VAR(ampSECT) TYPE(CHAR) LEN(1) SECTION DCL VAR(ampLIBSUFFIX) TYPE(CHAR) LEN(2) DCL VAR(ampPROF) TYPE(CHAR) LEN(10) DCL VAR(ampUSERID) TYPE(CHAR) LEN(10) DCL VAR(ampUSERTXT) TYPE(CHAR) LEN(50)
CALLING
CALLED
Advantages of OPM
bull Donrsquot have to have all parts of the application done to test
bull Parts of the application can be changed without affecting the entire application
Disadvantages of OPM
bull Integrated Language not supported
Advantages of ILE
bull Integrated Language Supportndash Best language for the task
bull You donrsquot have to pass all parameters to the program ndash previous values will be used
Disadvantages of ILE
bull All modules must be in place to test application
bull Version Control
DOWHILE Loopbull DCL VAR(ampLGL) TYPE(LGL)CHECK IF COND(NOT ampLGL) THEN(GOTO DONE) (group of CL commands)GOTO CHECKDONE
bull New-style coding exampleEvaluates COND at top of loop
DOWHILE COND(ampLGL) (group of CL commands) 1048773 body will be run zero or more timesENDDO
DOUNTIL Loop bull Old style coding exampleDCL VAR(ampLGL) TYPE(LGL)LOOP (group of CL commands)IF COND(NOT ampLGL) THEN(GOTO LOOP)
bull New style coding exampleEvaluates COND at bottom of loop
DOUNTIL COND(ampLGL) (group of CL commands) 1048773 body will be run one or more timesENDDO
DOFOR Loopbull SyntaxDOFOR VAR( ) FROM( ) TO( ) BY( )bullbull VAR must be INT or UINT variablebull FROM and TO can be integer constants expressions or
variablesbull BY must be an integer constant (can be negative)
defaults to 1 other parameters are requiredbull FROMTO expressions are evaluated at loop initiation TOevaluated after increment
DOFOR Loop (continued)bull Old-style coding example
DCL ampLOOPCTL TYPE(DEC) LEN(5 0)DCL ampLOOPLMT TYPE(DEC) LEN(5 0)CHGVAR ampLOOPCTL VALUE(1)CHECK IF COND(ampLOOPCTL GT ampLOOPLMT) THEN(GOTO DONE) (group of CL commands)CHGVAR ampLOOPCTL VALUE(ampLOOPCTL+1)GOTO CHECKDONE
bull New-style coding exampleChecks for loop exit at top of loop (like DOWHILE)
DCL ampLOOPCTL TYPE(INT) LEN(4)DCL ampLOOPLMT TYPE(INT) LEN(4)DOFOR VAR(ampLOOPCTL) FROM(1) TO(ampLOOPLMT) BY(1) (group of CL commands) 1048773 body will be run zero or more timesENDDO
LEAVE and ITERATEbull Allowed only within a DOWHILE DOUNTIL or DOFOR group
bull LEAVE passes control to next CL statement following loop ENDDObull ITERATE passes control to end of loop and tests loop exit condition
bull Both support CMDLBL (Command label) parameter to allowjump out of multiple (nested) loopsndash Both default to CURRENT loopbull Example (group of CL commands)IF (SST(ampNAME 1 10) EQ lsquoNONErsquo) THEN(LEAVE LOOP1)ELSE (DO)IF (SST(ampNAME 11 10) EQ lsquoLIBLrsquo) THEN(ITERATE)ENDDO (group of CL commands)
SELECT Groupbull SELECT starts a ldquoconditionrdquo groupbull ENDSELECT ends group
bull Group must have at least one WHENndash WHEN command has COND and THEN parameters (like IF)bull OTHERWISE (optional) run if no WHEN COND = Truendash OTHERWISE command has only CMD parameter (like ELSE)bull Example
SELECTWHEN COND(ampTYPE EQ CMD) THEN(DO) hellip(group of CL commands)ENDDOWHEN COND(ampTYPE EQ PGM) THEN(DO) helliphellip(group of CL commands)ENDDOhellipOTHERWISE CMD(CHGVAR ampBADTYPE lsquo1rsquo)ENDSELECT
Enhanced File Support
Will support up to 5 file instances using DCLF
bull Instances can be for the same or different files
bull New OPNID (Open identifier) parameter added to
DCLF statement
bull Default for OPNID is NONE
ndashOnly one DCLF allowed with OPNID(NONE)
bull OPNID accepts simple name up to 10 characters
Enhanced File Support (continued)
If OPNID specified declared CL variables areprefixed by this name and an underscore (egampMYTESTFILE_CUSTNAME )bull OPNID added to existing file IO CL commandsndash RCVFndashENDRCVndash SNDFndashSNDRCVFndash WAIT
File variables Identifier qualification
DCLF FILE(STUDENTS) OPNID(STPF) DCLF FILE(STUDDF) OPNID(DSPF) DCL ampEOF LGL 1 CHGVAR ampEOF 0 RCVF OPNID(STPF) DOWHILE (NOT ampDSPF-IN03) CHGVAR ampDSPF-FINESOWED ampSTPF-FINESOWED IF COND(ampDSPF-FEESOWED GT ampSTPF-FEESOWED) +
THEN(CHGVAR ampDSPF-IN30 1) IF COND(ampDSPF-FINESOWED NE ampSTPF-FINESOWED) +
THEN(CHGVAR ampDSPF-IN31 1) SNDRCVF OPNID(DSPF) RCVF OPNID(STPF)
PGM
DCLF FILE(RADIO) RCDFMT(PROMPT) DCL VAR(ampLEN) TYPE(DEC) LEN(2) DCL VAR(ampOPTION) TYPE(CHAR) LEN(50) DCL VAR(ampDIV) TYPE(CHAR) LEN(10) CALLPRC PRC(ASSIGN2B) PARM(ampDIV ampOPTION)
Called program receiving passed parameters
PGM PARM(ampDIVI ampOPTI) DCL VAR(ampDIVI) TYPE(CHAR) LEN(10) DCL VAR(ampOPTI) TYPE(CHAR) LEN(50)
IF (ampDIVI EQ DIVISION2) THEN(DO) OVRDBF FILE(INFILE) TOFILE(QGPLCHAP8AS2) + MBR(DIVISION2) POSITION(START) SHARE(YES) ENDDO OPNQRYF FILE((INFILE)) QRYSLT(ampOPTI) + KEYFLD((EMPNO)) CPYFRMQRYF FROMOPNID(INFILE) TOFILE(QTEMPCHAP8AS2) + MBROPT(REPLACE) CRTFILE(YES)
And passing it further down the line to another program utility or tool
Passing parameters by valuebull CALLPRC (Call Procedure) command
supports calls from ILE CL procedures to other ILE procedures
bull In prior releases CALLPRC only supported passing parameters by reference
bull Can specify BYREF or BYVAL special valuefor each parameter being passed
bull Enables ILE CL to call many MI and C functions and other procedure APIs
bull Maximum numbers of parameters 300
- IBC233
- Agenda
- Slide 3
- Eyes FOCUS - where
- Using ldquoTYPE amp EDITINGrdquo to get what you want
- Lowercase in Display Files
- OPM Call (original program model)
- How it works
- ILE Call (Integrated Language Environment)
- Slide 10
- Slide 11
- Slide 12
- Slide 13
- Advantages of OPM
- Disadvantages of OPM
- Advantages of ILE
- Disadvantages of ILE
- DOWHILE Loop
- DOUNTIL Loop
- DOFOR Loop
- DOFOR Loop (continued)
- LEAVE and ITERATE
- SELECT Group
- Enhanced File Support
- Enhanced File Support (continued)
- File variables Identifier qualification
- Slide 27
- Passing parameters by value
-
COURSE-USERID SECTION ASGN PROF-USERID
CALL PGM(OA0CHKALL) PARM( DB233 E A1 ABERNS)
CALL PGM(OA0CHKALL) PARM( DB233 B A3 MCKENNA)
PGM PARM(ampCRSUSERID ampSECT ampLIBSUFFIX ampPROF)
PARMs Course UserID Section code Asgn + Lib suffix Profs Userid
DCL VAR(ampCRSUSERID) TYPE(CHAR) LEN(5) course + User Id eg DC324 DCL VAR(ampSECT) TYPE(CHAR) LEN(1) SECTION DCL VAR(ampLIBSUFFIX) TYPE(CHAR) LEN(2) DCL VAR(ampPROF) TYPE(CHAR) LEN(10) DCL VAR(ampUSERID) TYPE(CHAR) LEN(10) DCL VAR(ampUSERTXT) TYPE(CHAR) LEN(50)
CALLING
CALLED
Advantages of OPM
bull Donrsquot have to have all parts of the application done to test
bull Parts of the application can be changed without affecting the entire application
Disadvantages of OPM
bull Integrated Language not supported
Advantages of ILE
bull Integrated Language Supportndash Best language for the task
bull You donrsquot have to pass all parameters to the program ndash previous values will be used
Disadvantages of ILE
bull All modules must be in place to test application
bull Version Control
DOWHILE Loopbull DCL VAR(ampLGL) TYPE(LGL)CHECK IF COND(NOT ampLGL) THEN(GOTO DONE) (group of CL commands)GOTO CHECKDONE
bull New-style coding exampleEvaluates COND at top of loop
DOWHILE COND(ampLGL) (group of CL commands) 1048773 body will be run zero or more timesENDDO
DOUNTIL Loop bull Old style coding exampleDCL VAR(ampLGL) TYPE(LGL)LOOP (group of CL commands)IF COND(NOT ampLGL) THEN(GOTO LOOP)
bull New style coding exampleEvaluates COND at bottom of loop
DOUNTIL COND(ampLGL) (group of CL commands) 1048773 body will be run one or more timesENDDO
DOFOR Loopbull SyntaxDOFOR VAR( ) FROM( ) TO( ) BY( )bullbull VAR must be INT or UINT variablebull FROM and TO can be integer constants expressions or
variablesbull BY must be an integer constant (can be negative)
defaults to 1 other parameters are requiredbull FROMTO expressions are evaluated at loop initiation TOevaluated after increment
DOFOR Loop (continued)bull Old-style coding example
DCL ampLOOPCTL TYPE(DEC) LEN(5 0)DCL ampLOOPLMT TYPE(DEC) LEN(5 0)CHGVAR ampLOOPCTL VALUE(1)CHECK IF COND(ampLOOPCTL GT ampLOOPLMT) THEN(GOTO DONE) (group of CL commands)CHGVAR ampLOOPCTL VALUE(ampLOOPCTL+1)GOTO CHECKDONE
bull New-style coding exampleChecks for loop exit at top of loop (like DOWHILE)
DCL ampLOOPCTL TYPE(INT) LEN(4)DCL ampLOOPLMT TYPE(INT) LEN(4)DOFOR VAR(ampLOOPCTL) FROM(1) TO(ampLOOPLMT) BY(1) (group of CL commands) 1048773 body will be run zero or more timesENDDO
LEAVE and ITERATEbull Allowed only within a DOWHILE DOUNTIL or DOFOR group
bull LEAVE passes control to next CL statement following loop ENDDObull ITERATE passes control to end of loop and tests loop exit condition
bull Both support CMDLBL (Command label) parameter to allowjump out of multiple (nested) loopsndash Both default to CURRENT loopbull Example (group of CL commands)IF (SST(ampNAME 1 10) EQ lsquoNONErsquo) THEN(LEAVE LOOP1)ELSE (DO)IF (SST(ampNAME 11 10) EQ lsquoLIBLrsquo) THEN(ITERATE)ENDDO (group of CL commands)
SELECT Groupbull SELECT starts a ldquoconditionrdquo groupbull ENDSELECT ends group
bull Group must have at least one WHENndash WHEN command has COND and THEN parameters (like IF)bull OTHERWISE (optional) run if no WHEN COND = Truendash OTHERWISE command has only CMD parameter (like ELSE)bull Example
SELECTWHEN COND(ampTYPE EQ CMD) THEN(DO) hellip(group of CL commands)ENDDOWHEN COND(ampTYPE EQ PGM) THEN(DO) helliphellip(group of CL commands)ENDDOhellipOTHERWISE CMD(CHGVAR ampBADTYPE lsquo1rsquo)ENDSELECT
Enhanced File Support
Will support up to 5 file instances using DCLF
bull Instances can be for the same or different files
bull New OPNID (Open identifier) parameter added to
DCLF statement
bull Default for OPNID is NONE
ndashOnly one DCLF allowed with OPNID(NONE)
bull OPNID accepts simple name up to 10 characters
Enhanced File Support (continued)
If OPNID specified declared CL variables areprefixed by this name and an underscore (egampMYTESTFILE_CUSTNAME )bull OPNID added to existing file IO CL commandsndash RCVFndashENDRCVndash SNDFndashSNDRCVFndash WAIT
File variables Identifier qualification
DCLF FILE(STUDENTS) OPNID(STPF) DCLF FILE(STUDDF) OPNID(DSPF) DCL ampEOF LGL 1 CHGVAR ampEOF 0 RCVF OPNID(STPF) DOWHILE (NOT ampDSPF-IN03) CHGVAR ampDSPF-FINESOWED ampSTPF-FINESOWED IF COND(ampDSPF-FEESOWED GT ampSTPF-FEESOWED) +
THEN(CHGVAR ampDSPF-IN30 1) IF COND(ampDSPF-FINESOWED NE ampSTPF-FINESOWED) +
THEN(CHGVAR ampDSPF-IN31 1) SNDRCVF OPNID(DSPF) RCVF OPNID(STPF)
PGM
DCLF FILE(RADIO) RCDFMT(PROMPT) DCL VAR(ampLEN) TYPE(DEC) LEN(2) DCL VAR(ampOPTION) TYPE(CHAR) LEN(50) DCL VAR(ampDIV) TYPE(CHAR) LEN(10) CALLPRC PRC(ASSIGN2B) PARM(ampDIV ampOPTION)
Called program receiving passed parameters
PGM PARM(ampDIVI ampOPTI) DCL VAR(ampDIVI) TYPE(CHAR) LEN(10) DCL VAR(ampOPTI) TYPE(CHAR) LEN(50)
IF (ampDIVI EQ DIVISION2) THEN(DO) OVRDBF FILE(INFILE) TOFILE(QGPLCHAP8AS2) + MBR(DIVISION2) POSITION(START) SHARE(YES) ENDDO OPNQRYF FILE((INFILE)) QRYSLT(ampOPTI) + KEYFLD((EMPNO)) CPYFRMQRYF FROMOPNID(INFILE) TOFILE(QTEMPCHAP8AS2) + MBROPT(REPLACE) CRTFILE(YES)
And passing it further down the line to another program utility or tool
Passing parameters by valuebull CALLPRC (Call Procedure) command
supports calls from ILE CL procedures to other ILE procedures
bull In prior releases CALLPRC only supported passing parameters by reference
bull Can specify BYREF or BYVAL special valuefor each parameter being passed
bull Enables ILE CL to call many MI and C functions and other procedure APIs
bull Maximum numbers of parameters 300
- IBC233
- Agenda
- Slide 3
- Eyes FOCUS - where
- Using ldquoTYPE amp EDITINGrdquo to get what you want
- Lowercase in Display Files
- OPM Call (original program model)
- How it works
- ILE Call (Integrated Language Environment)
- Slide 10
- Slide 11
- Slide 12
- Slide 13
- Advantages of OPM
- Disadvantages of OPM
- Advantages of ILE
- Disadvantages of ILE
- DOWHILE Loop
- DOUNTIL Loop
- DOFOR Loop
- DOFOR Loop (continued)
- LEAVE and ITERATE
- SELECT Group
- Enhanced File Support
- Enhanced File Support (continued)
- File variables Identifier qualification
- Slide 27
- Passing parameters by value
-
Advantages of OPM
bull Donrsquot have to have all parts of the application done to test
bull Parts of the application can be changed without affecting the entire application
Disadvantages of OPM
bull Integrated Language not supported
Advantages of ILE
bull Integrated Language Supportndash Best language for the task
bull You donrsquot have to pass all parameters to the program ndash previous values will be used
Disadvantages of ILE
bull All modules must be in place to test application
bull Version Control
DOWHILE Loopbull DCL VAR(ampLGL) TYPE(LGL)CHECK IF COND(NOT ampLGL) THEN(GOTO DONE) (group of CL commands)GOTO CHECKDONE
bull New-style coding exampleEvaluates COND at top of loop
DOWHILE COND(ampLGL) (group of CL commands) 1048773 body will be run zero or more timesENDDO
DOUNTIL Loop bull Old style coding exampleDCL VAR(ampLGL) TYPE(LGL)LOOP (group of CL commands)IF COND(NOT ampLGL) THEN(GOTO LOOP)
bull New style coding exampleEvaluates COND at bottom of loop
DOUNTIL COND(ampLGL) (group of CL commands) 1048773 body will be run one or more timesENDDO
DOFOR Loopbull SyntaxDOFOR VAR( ) FROM( ) TO( ) BY( )bullbull VAR must be INT or UINT variablebull FROM and TO can be integer constants expressions or
variablesbull BY must be an integer constant (can be negative)
defaults to 1 other parameters are requiredbull FROMTO expressions are evaluated at loop initiation TOevaluated after increment
DOFOR Loop (continued)bull Old-style coding example
DCL ampLOOPCTL TYPE(DEC) LEN(5 0)DCL ampLOOPLMT TYPE(DEC) LEN(5 0)CHGVAR ampLOOPCTL VALUE(1)CHECK IF COND(ampLOOPCTL GT ampLOOPLMT) THEN(GOTO DONE) (group of CL commands)CHGVAR ampLOOPCTL VALUE(ampLOOPCTL+1)GOTO CHECKDONE
bull New-style coding exampleChecks for loop exit at top of loop (like DOWHILE)
DCL ampLOOPCTL TYPE(INT) LEN(4)DCL ampLOOPLMT TYPE(INT) LEN(4)DOFOR VAR(ampLOOPCTL) FROM(1) TO(ampLOOPLMT) BY(1) (group of CL commands) 1048773 body will be run zero or more timesENDDO
LEAVE and ITERATEbull Allowed only within a DOWHILE DOUNTIL or DOFOR group
bull LEAVE passes control to next CL statement following loop ENDDObull ITERATE passes control to end of loop and tests loop exit condition
bull Both support CMDLBL (Command label) parameter to allowjump out of multiple (nested) loopsndash Both default to CURRENT loopbull Example (group of CL commands)IF (SST(ampNAME 1 10) EQ lsquoNONErsquo) THEN(LEAVE LOOP1)ELSE (DO)IF (SST(ampNAME 11 10) EQ lsquoLIBLrsquo) THEN(ITERATE)ENDDO (group of CL commands)
SELECT Groupbull SELECT starts a ldquoconditionrdquo groupbull ENDSELECT ends group
bull Group must have at least one WHENndash WHEN command has COND and THEN parameters (like IF)bull OTHERWISE (optional) run if no WHEN COND = Truendash OTHERWISE command has only CMD parameter (like ELSE)bull Example
SELECTWHEN COND(ampTYPE EQ CMD) THEN(DO) hellip(group of CL commands)ENDDOWHEN COND(ampTYPE EQ PGM) THEN(DO) helliphellip(group of CL commands)ENDDOhellipOTHERWISE CMD(CHGVAR ampBADTYPE lsquo1rsquo)ENDSELECT
Enhanced File Support
Will support up to 5 file instances using DCLF
bull Instances can be for the same or different files
bull New OPNID (Open identifier) parameter added to
DCLF statement
bull Default for OPNID is NONE
ndashOnly one DCLF allowed with OPNID(NONE)
bull OPNID accepts simple name up to 10 characters
Enhanced File Support (continued)
If OPNID specified declared CL variables areprefixed by this name and an underscore (egampMYTESTFILE_CUSTNAME )bull OPNID added to existing file IO CL commandsndash RCVFndashENDRCVndash SNDFndashSNDRCVFndash WAIT
File variables Identifier qualification
DCLF FILE(STUDENTS) OPNID(STPF) DCLF FILE(STUDDF) OPNID(DSPF) DCL ampEOF LGL 1 CHGVAR ampEOF 0 RCVF OPNID(STPF) DOWHILE (NOT ampDSPF-IN03) CHGVAR ampDSPF-FINESOWED ampSTPF-FINESOWED IF COND(ampDSPF-FEESOWED GT ampSTPF-FEESOWED) +
THEN(CHGVAR ampDSPF-IN30 1) IF COND(ampDSPF-FINESOWED NE ampSTPF-FINESOWED) +
THEN(CHGVAR ampDSPF-IN31 1) SNDRCVF OPNID(DSPF) RCVF OPNID(STPF)
PGM
DCLF FILE(RADIO) RCDFMT(PROMPT) DCL VAR(ampLEN) TYPE(DEC) LEN(2) DCL VAR(ampOPTION) TYPE(CHAR) LEN(50) DCL VAR(ampDIV) TYPE(CHAR) LEN(10) CALLPRC PRC(ASSIGN2B) PARM(ampDIV ampOPTION)
Called program receiving passed parameters
PGM PARM(ampDIVI ampOPTI) DCL VAR(ampDIVI) TYPE(CHAR) LEN(10) DCL VAR(ampOPTI) TYPE(CHAR) LEN(50)
IF (ampDIVI EQ DIVISION2) THEN(DO) OVRDBF FILE(INFILE) TOFILE(QGPLCHAP8AS2) + MBR(DIVISION2) POSITION(START) SHARE(YES) ENDDO OPNQRYF FILE((INFILE)) QRYSLT(ampOPTI) + KEYFLD((EMPNO)) CPYFRMQRYF FROMOPNID(INFILE) TOFILE(QTEMPCHAP8AS2) + MBROPT(REPLACE) CRTFILE(YES)
And passing it further down the line to another program utility or tool
Passing parameters by valuebull CALLPRC (Call Procedure) command
supports calls from ILE CL procedures to other ILE procedures
bull In prior releases CALLPRC only supported passing parameters by reference
bull Can specify BYREF or BYVAL special valuefor each parameter being passed
bull Enables ILE CL to call many MI and C functions and other procedure APIs
bull Maximum numbers of parameters 300
- IBC233
- Agenda
- Slide 3
- Eyes FOCUS - where
- Using ldquoTYPE amp EDITINGrdquo to get what you want
- Lowercase in Display Files
- OPM Call (original program model)
- How it works
- ILE Call (Integrated Language Environment)
- Slide 10
- Slide 11
- Slide 12
- Slide 13
- Advantages of OPM
- Disadvantages of OPM
- Advantages of ILE
- Disadvantages of ILE
- DOWHILE Loop
- DOUNTIL Loop
- DOFOR Loop
- DOFOR Loop (continued)
- LEAVE and ITERATE
- SELECT Group
- Enhanced File Support
- Enhanced File Support (continued)
- File variables Identifier qualification
- Slide 27
- Passing parameters by value
-
Disadvantages of OPM
bull Integrated Language not supported
Advantages of ILE
bull Integrated Language Supportndash Best language for the task
bull You donrsquot have to pass all parameters to the program ndash previous values will be used
Disadvantages of ILE
bull All modules must be in place to test application
bull Version Control
DOWHILE Loopbull DCL VAR(ampLGL) TYPE(LGL)CHECK IF COND(NOT ampLGL) THEN(GOTO DONE) (group of CL commands)GOTO CHECKDONE
bull New-style coding exampleEvaluates COND at top of loop
DOWHILE COND(ampLGL) (group of CL commands) 1048773 body will be run zero or more timesENDDO
DOUNTIL Loop bull Old style coding exampleDCL VAR(ampLGL) TYPE(LGL)LOOP (group of CL commands)IF COND(NOT ampLGL) THEN(GOTO LOOP)
bull New style coding exampleEvaluates COND at bottom of loop
DOUNTIL COND(ampLGL) (group of CL commands) 1048773 body will be run one or more timesENDDO
DOFOR Loopbull SyntaxDOFOR VAR( ) FROM( ) TO( ) BY( )bullbull VAR must be INT or UINT variablebull FROM and TO can be integer constants expressions or
variablesbull BY must be an integer constant (can be negative)
defaults to 1 other parameters are requiredbull FROMTO expressions are evaluated at loop initiation TOevaluated after increment
DOFOR Loop (continued)bull Old-style coding example
DCL ampLOOPCTL TYPE(DEC) LEN(5 0)DCL ampLOOPLMT TYPE(DEC) LEN(5 0)CHGVAR ampLOOPCTL VALUE(1)CHECK IF COND(ampLOOPCTL GT ampLOOPLMT) THEN(GOTO DONE) (group of CL commands)CHGVAR ampLOOPCTL VALUE(ampLOOPCTL+1)GOTO CHECKDONE
bull New-style coding exampleChecks for loop exit at top of loop (like DOWHILE)
DCL ampLOOPCTL TYPE(INT) LEN(4)DCL ampLOOPLMT TYPE(INT) LEN(4)DOFOR VAR(ampLOOPCTL) FROM(1) TO(ampLOOPLMT) BY(1) (group of CL commands) 1048773 body will be run zero or more timesENDDO
LEAVE and ITERATEbull Allowed only within a DOWHILE DOUNTIL or DOFOR group
bull LEAVE passes control to next CL statement following loop ENDDObull ITERATE passes control to end of loop and tests loop exit condition
bull Both support CMDLBL (Command label) parameter to allowjump out of multiple (nested) loopsndash Both default to CURRENT loopbull Example (group of CL commands)IF (SST(ampNAME 1 10) EQ lsquoNONErsquo) THEN(LEAVE LOOP1)ELSE (DO)IF (SST(ampNAME 11 10) EQ lsquoLIBLrsquo) THEN(ITERATE)ENDDO (group of CL commands)
SELECT Groupbull SELECT starts a ldquoconditionrdquo groupbull ENDSELECT ends group
bull Group must have at least one WHENndash WHEN command has COND and THEN parameters (like IF)bull OTHERWISE (optional) run if no WHEN COND = Truendash OTHERWISE command has only CMD parameter (like ELSE)bull Example
SELECTWHEN COND(ampTYPE EQ CMD) THEN(DO) hellip(group of CL commands)ENDDOWHEN COND(ampTYPE EQ PGM) THEN(DO) helliphellip(group of CL commands)ENDDOhellipOTHERWISE CMD(CHGVAR ampBADTYPE lsquo1rsquo)ENDSELECT
Enhanced File Support
Will support up to 5 file instances using DCLF
bull Instances can be for the same or different files
bull New OPNID (Open identifier) parameter added to
DCLF statement
bull Default for OPNID is NONE
ndashOnly one DCLF allowed with OPNID(NONE)
bull OPNID accepts simple name up to 10 characters
Enhanced File Support (continued)
If OPNID specified declared CL variables areprefixed by this name and an underscore (egampMYTESTFILE_CUSTNAME )bull OPNID added to existing file IO CL commandsndash RCVFndashENDRCVndash SNDFndashSNDRCVFndash WAIT
File variables Identifier qualification
DCLF FILE(STUDENTS) OPNID(STPF) DCLF FILE(STUDDF) OPNID(DSPF) DCL ampEOF LGL 1 CHGVAR ampEOF 0 RCVF OPNID(STPF) DOWHILE (NOT ampDSPF-IN03) CHGVAR ampDSPF-FINESOWED ampSTPF-FINESOWED IF COND(ampDSPF-FEESOWED GT ampSTPF-FEESOWED) +
THEN(CHGVAR ampDSPF-IN30 1) IF COND(ampDSPF-FINESOWED NE ampSTPF-FINESOWED) +
THEN(CHGVAR ampDSPF-IN31 1) SNDRCVF OPNID(DSPF) RCVF OPNID(STPF)
PGM
DCLF FILE(RADIO) RCDFMT(PROMPT) DCL VAR(ampLEN) TYPE(DEC) LEN(2) DCL VAR(ampOPTION) TYPE(CHAR) LEN(50) DCL VAR(ampDIV) TYPE(CHAR) LEN(10) CALLPRC PRC(ASSIGN2B) PARM(ampDIV ampOPTION)
Called program receiving passed parameters
PGM PARM(ampDIVI ampOPTI) DCL VAR(ampDIVI) TYPE(CHAR) LEN(10) DCL VAR(ampOPTI) TYPE(CHAR) LEN(50)
IF (ampDIVI EQ DIVISION2) THEN(DO) OVRDBF FILE(INFILE) TOFILE(QGPLCHAP8AS2) + MBR(DIVISION2) POSITION(START) SHARE(YES) ENDDO OPNQRYF FILE((INFILE)) QRYSLT(ampOPTI) + KEYFLD((EMPNO)) CPYFRMQRYF FROMOPNID(INFILE) TOFILE(QTEMPCHAP8AS2) + MBROPT(REPLACE) CRTFILE(YES)
And passing it further down the line to another program utility or tool
Passing parameters by valuebull CALLPRC (Call Procedure) command
supports calls from ILE CL procedures to other ILE procedures
bull In prior releases CALLPRC only supported passing parameters by reference
bull Can specify BYREF or BYVAL special valuefor each parameter being passed
bull Enables ILE CL to call many MI and C functions and other procedure APIs
bull Maximum numbers of parameters 300
- IBC233
- Agenda
- Slide 3
- Eyes FOCUS - where
- Using ldquoTYPE amp EDITINGrdquo to get what you want
- Lowercase in Display Files
- OPM Call (original program model)
- How it works
- ILE Call (Integrated Language Environment)
- Slide 10
- Slide 11
- Slide 12
- Slide 13
- Advantages of OPM
- Disadvantages of OPM
- Advantages of ILE
- Disadvantages of ILE
- DOWHILE Loop
- DOUNTIL Loop
- DOFOR Loop
- DOFOR Loop (continued)
- LEAVE and ITERATE
- SELECT Group
- Enhanced File Support
- Enhanced File Support (continued)
- File variables Identifier qualification
- Slide 27
- Passing parameters by value
-
Advantages of ILE
bull Integrated Language Supportndash Best language for the task
bull You donrsquot have to pass all parameters to the program ndash previous values will be used
Disadvantages of ILE
bull All modules must be in place to test application
bull Version Control
DOWHILE Loopbull DCL VAR(ampLGL) TYPE(LGL)CHECK IF COND(NOT ampLGL) THEN(GOTO DONE) (group of CL commands)GOTO CHECKDONE
bull New-style coding exampleEvaluates COND at top of loop
DOWHILE COND(ampLGL) (group of CL commands) 1048773 body will be run zero or more timesENDDO
DOUNTIL Loop bull Old style coding exampleDCL VAR(ampLGL) TYPE(LGL)LOOP (group of CL commands)IF COND(NOT ampLGL) THEN(GOTO LOOP)
bull New style coding exampleEvaluates COND at bottom of loop
DOUNTIL COND(ampLGL) (group of CL commands) 1048773 body will be run one or more timesENDDO
DOFOR Loopbull SyntaxDOFOR VAR( ) FROM( ) TO( ) BY( )bullbull VAR must be INT or UINT variablebull FROM and TO can be integer constants expressions or
variablesbull BY must be an integer constant (can be negative)
defaults to 1 other parameters are requiredbull FROMTO expressions are evaluated at loop initiation TOevaluated after increment
DOFOR Loop (continued)bull Old-style coding example
DCL ampLOOPCTL TYPE(DEC) LEN(5 0)DCL ampLOOPLMT TYPE(DEC) LEN(5 0)CHGVAR ampLOOPCTL VALUE(1)CHECK IF COND(ampLOOPCTL GT ampLOOPLMT) THEN(GOTO DONE) (group of CL commands)CHGVAR ampLOOPCTL VALUE(ampLOOPCTL+1)GOTO CHECKDONE
bull New-style coding exampleChecks for loop exit at top of loop (like DOWHILE)
DCL ampLOOPCTL TYPE(INT) LEN(4)DCL ampLOOPLMT TYPE(INT) LEN(4)DOFOR VAR(ampLOOPCTL) FROM(1) TO(ampLOOPLMT) BY(1) (group of CL commands) 1048773 body will be run zero or more timesENDDO
LEAVE and ITERATEbull Allowed only within a DOWHILE DOUNTIL or DOFOR group
bull LEAVE passes control to next CL statement following loop ENDDObull ITERATE passes control to end of loop and tests loop exit condition
bull Both support CMDLBL (Command label) parameter to allowjump out of multiple (nested) loopsndash Both default to CURRENT loopbull Example (group of CL commands)IF (SST(ampNAME 1 10) EQ lsquoNONErsquo) THEN(LEAVE LOOP1)ELSE (DO)IF (SST(ampNAME 11 10) EQ lsquoLIBLrsquo) THEN(ITERATE)ENDDO (group of CL commands)
SELECT Groupbull SELECT starts a ldquoconditionrdquo groupbull ENDSELECT ends group
bull Group must have at least one WHENndash WHEN command has COND and THEN parameters (like IF)bull OTHERWISE (optional) run if no WHEN COND = Truendash OTHERWISE command has only CMD parameter (like ELSE)bull Example
SELECTWHEN COND(ampTYPE EQ CMD) THEN(DO) hellip(group of CL commands)ENDDOWHEN COND(ampTYPE EQ PGM) THEN(DO) helliphellip(group of CL commands)ENDDOhellipOTHERWISE CMD(CHGVAR ampBADTYPE lsquo1rsquo)ENDSELECT
Enhanced File Support
Will support up to 5 file instances using DCLF
bull Instances can be for the same or different files
bull New OPNID (Open identifier) parameter added to
DCLF statement
bull Default for OPNID is NONE
ndashOnly one DCLF allowed with OPNID(NONE)
bull OPNID accepts simple name up to 10 characters
Enhanced File Support (continued)
If OPNID specified declared CL variables areprefixed by this name and an underscore (egampMYTESTFILE_CUSTNAME )bull OPNID added to existing file IO CL commandsndash RCVFndashENDRCVndash SNDFndashSNDRCVFndash WAIT
File variables Identifier qualification
DCLF FILE(STUDENTS) OPNID(STPF) DCLF FILE(STUDDF) OPNID(DSPF) DCL ampEOF LGL 1 CHGVAR ampEOF 0 RCVF OPNID(STPF) DOWHILE (NOT ampDSPF-IN03) CHGVAR ampDSPF-FINESOWED ampSTPF-FINESOWED IF COND(ampDSPF-FEESOWED GT ampSTPF-FEESOWED) +
THEN(CHGVAR ampDSPF-IN30 1) IF COND(ampDSPF-FINESOWED NE ampSTPF-FINESOWED) +
THEN(CHGVAR ampDSPF-IN31 1) SNDRCVF OPNID(DSPF) RCVF OPNID(STPF)
PGM
DCLF FILE(RADIO) RCDFMT(PROMPT) DCL VAR(ampLEN) TYPE(DEC) LEN(2) DCL VAR(ampOPTION) TYPE(CHAR) LEN(50) DCL VAR(ampDIV) TYPE(CHAR) LEN(10) CALLPRC PRC(ASSIGN2B) PARM(ampDIV ampOPTION)
Called program receiving passed parameters
PGM PARM(ampDIVI ampOPTI) DCL VAR(ampDIVI) TYPE(CHAR) LEN(10) DCL VAR(ampOPTI) TYPE(CHAR) LEN(50)
IF (ampDIVI EQ DIVISION2) THEN(DO) OVRDBF FILE(INFILE) TOFILE(QGPLCHAP8AS2) + MBR(DIVISION2) POSITION(START) SHARE(YES) ENDDO OPNQRYF FILE((INFILE)) QRYSLT(ampOPTI) + KEYFLD((EMPNO)) CPYFRMQRYF FROMOPNID(INFILE) TOFILE(QTEMPCHAP8AS2) + MBROPT(REPLACE) CRTFILE(YES)
And passing it further down the line to another program utility or tool
Passing parameters by valuebull CALLPRC (Call Procedure) command
supports calls from ILE CL procedures to other ILE procedures
bull In prior releases CALLPRC only supported passing parameters by reference
bull Can specify BYREF or BYVAL special valuefor each parameter being passed
bull Enables ILE CL to call many MI and C functions and other procedure APIs
bull Maximum numbers of parameters 300
- IBC233
- Agenda
- Slide 3
- Eyes FOCUS - where
- Using ldquoTYPE amp EDITINGrdquo to get what you want
- Lowercase in Display Files
- OPM Call (original program model)
- How it works
- ILE Call (Integrated Language Environment)
- Slide 10
- Slide 11
- Slide 12
- Slide 13
- Advantages of OPM
- Disadvantages of OPM
- Advantages of ILE
- Disadvantages of ILE
- DOWHILE Loop
- DOUNTIL Loop
- DOFOR Loop
- DOFOR Loop (continued)
- LEAVE and ITERATE
- SELECT Group
- Enhanced File Support
- Enhanced File Support (continued)
- File variables Identifier qualification
- Slide 27
- Passing parameters by value
-
Disadvantages of ILE
bull All modules must be in place to test application
bull Version Control
DOWHILE Loopbull DCL VAR(ampLGL) TYPE(LGL)CHECK IF COND(NOT ampLGL) THEN(GOTO DONE) (group of CL commands)GOTO CHECKDONE
bull New-style coding exampleEvaluates COND at top of loop
DOWHILE COND(ampLGL) (group of CL commands) 1048773 body will be run zero or more timesENDDO
DOUNTIL Loop bull Old style coding exampleDCL VAR(ampLGL) TYPE(LGL)LOOP (group of CL commands)IF COND(NOT ampLGL) THEN(GOTO LOOP)
bull New style coding exampleEvaluates COND at bottom of loop
DOUNTIL COND(ampLGL) (group of CL commands) 1048773 body will be run one or more timesENDDO
DOFOR Loopbull SyntaxDOFOR VAR( ) FROM( ) TO( ) BY( )bullbull VAR must be INT or UINT variablebull FROM and TO can be integer constants expressions or
variablesbull BY must be an integer constant (can be negative)
defaults to 1 other parameters are requiredbull FROMTO expressions are evaluated at loop initiation TOevaluated after increment
DOFOR Loop (continued)bull Old-style coding example
DCL ampLOOPCTL TYPE(DEC) LEN(5 0)DCL ampLOOPLMT TYPE(DEC) LEN(5 0)CHGVAR ampLOOPCTL VALUE(1)CHECK IF COND(ampLOOPCTL GT ampLOOPLMT) THEN(GOTO DONE) (group of CL commands)CHGVAR ampLOOPCTL VALUE(ampLOOPCTL+1)GOTO CHECKDONE
bull New-style coding exampleChecks for loop exit at top of loop (like DOWHILE)
DCL ampLOOPCTL TYPE(INT) LEN(4)DCL ampLOOPLMT TYPE(INT) LEN(4)DOFOR VAR(ampLOOPCTL) FROM(1) TO(ampLOOPLMT) BY(1) (group of CL commands) 1048773 body will be run zero or more timesENDDO
LEAVE and ITERATEbull Allowed only within a DOWHILE DOUNTIL or DOFOR group
bull LEAVE passes control to next CL statement following loop ENDDObull ITERATE passes control to end of loop and tests loop exit condition
bull Both support CMDLBL (Command label) parameter to allowjump out of multiple (nested) loopsndash Both default to CURRENT loopbull Example (group of CL commands)IF (SST(ampNAME 1 10) EQ lsquoNONErsquo) THEN(LEAVE LOOP1)ELSE (DO)IF (SST(ampNAME 11 10) EQ lsquoLIBLrsquo) THEN(ITERATE)ENDDO (group of CL commands)
SELECT Groupbull SELECT starts a ldquoconditionrdquo groupbull ENDSELECT ends group
bull Group must have at least one WHENndash WHEN command has COND and THEN parameters (like IF)bull OTHERWISE (optional) run if no WHEN COND = Truendash OTHERWISE command has only CMD parameter (like ELSE)bull Example
SELECTWHEN COND(ampTYPE EQ CMD) THEN(DO) hellip(group of CL commands)ENDDOWHEN COND(ampTYPE EQ PGM) THEN(DO) helliphellip(group of CL commands)ENDDOhellipOTHERWISE CMD(CHGVAR ampBADTYPE lsquo1rsquo)ENDSELECT
Enhanced File Support
Will support up to 5 file instances using DCLF
bull Instances can be for the same or different files
bull New OPNID (Open identifier) parameter added to
DCLF statement
bull Default for OPNID is NONE
ndashOnly one DCLF allowed with OPNID(NONE)
bull OPNID accepts simple name up to 10 characters
Enhanced File Support (continued)
If OPNID specified declared CL variables areprefixed by this name and an underscore (egampMYTESTFILE_CUSTNAME )bull OPNID added to existing file IO CL commandsndash RCVFndashENDRCVndash SNDFndashSNDRCVFndash WAIT
File variables Identifier qualification
DCLF FILE(STUDENTS) OPNID(STPF) DCLF FILE(STUDDF) OPNID(DSPF) DCL ampEOF LGL 1 CHGVAR ampEOF 0 RCVF OPNID(STPF) DOWHILE (NOT ampDSPF-IN03) CHGVAR ampDSPF-FINESOWED ampSTPF-FINESOWED IF COND(ampDSPF-FEESOWED GT ampSTPF-FEESOWED) +
THEN(CHGVAR ampDSPF-IN30 1) IF COND(ampDSPF-FINESOWED NE ampSTPF-FINESOWED) +
THEN(CHGVAR ampDSPF-IN31 1) SNDRCVF OPNID(DSPF) RCVF OPNID(STPF)
PGM
DCLF FILE(RADIO) RCDFMT(PROMPT) DCL VAR(ampLEN) TYPE(DEC) LEN(2) DCL VAR(ampOPTION) TYPE(CHAR) LEN(50) DCL VAR(ampDIV) TYPE(CHAR) LEN(10) CALLPRC PRC(ASSIGN2B) PARM(ampDIV ampOPTION)
Called program receiving passed parameters
PGM PARM(ampDIVI ampOPTI) DCL VAR(ampDIVI) TYPE(CHAR) LEN(10) DCL VAR(ampOPTI) TYPE(CHAR) LEN(50)
IF (ampDIVI EQ DIVISION2) THEN(DO) OVRDBF FILE(INFILE) TOFILE(QGPLCHAP8AS2) + MBR(DIVISION2) POSITION(START) SHARE(YES) ENDDO OPNQRYF FILE((INFILE)) QRYSLT(ampOPTI) + KEYFLD((EMPNO)) CPYFRMQRYF FROMOPNID(INFILE) TOFILE(QTEMPCHAP8AS2) + MBROPT(REPLACE) CRTFILE(YES)
And passing it further down the line to another program utility or tool
Passing parameters by valuebull CALLPRC (Call Procedure) command
supports calls from ILE CL procedures to other ILE procedures
bull In prior releases CALLPRC only supported passing parameters by reference
bull Can specify BYREF or BYVAL special valuefor each parameter being passed
bull Enables ILE CL to call many MI and C functions and other procedure APIs
bull Maximum numbers of parameters 300
- IBC233
- Agenda
- Slide 3
- Eyes FOCUS - where
- Using ldquoTYPE amp EDITINGrdquo to get what you want
- Lowercase in Display Files
- OPM Call (original program model)
- How it works
- ILE Call (Integrated Language Environment)
- Slide 10
- Slide 11
- Slide 12
- Slide 13
- Advantages of OPM
- Disadvantages of OPM
- Advantages of ILE
- Disadvantages of ILE
- DOWHILE Loop
- DOUNTIL Loop
- DOFOR Loop
- DOFOR Loop (continued)
- LEAVE and ITERATE
- SELECT Group
- Enhanced File Support
- Enhanced File Support (continued)
- File variables Identifier qualification
- Slide 27
- Passing parameters by value
-
DOWHILE Loopbull DCL VAR(ampLGL) TYPE(LGL)CHECK IF COND(NOT ampLGL) THEN(GOTO DONE) (group of CL commands)GOTO CHECKDONE
bull New-style coding exampleEvaluates COND at top of loop
DOWHILE COND(ampLGL) (group of CL commands) 1048773 body will be run zero or more timesENDDO
DOUNTIL Loop bull Old style coding exampleDCL VAR(ampLGL) TYPE(LGL)LOOP (group of CL commands)IF COND(NOT ampLGL) THEN(GOTO LOOP)
bull New style coding exampleEvaluates COND at bottom of loop
DOUNTIL COND(ampLGL) (group of CL commands) 1048773 body will be run one or more timesENDDO
DOFOR Loopbull SyntaxDOFOR VAR( ) FROM( ) TO( ) BY( )bullbull VAR must be INT or UINT variablebull FROM and TO can be integer constants expressions or
variablesbull BY must be an integer constant (can be negative)
defaults to 1 other parameters are requiredbull FROMTO expressions are evaluated at loop initiation TOevaluated after increment
DOFOR Loop (continued)bull Old-style coding example
DCL ampLOOPCTL TYPE(DEC) LEN(5 0)DCL ampLOOPLMT TYPE(DEC) LEN(5 0)CHGVAR ampLOOPCTL VALUE(1)CHECK IF COND(ampLOOPCTL GT ampLOOPLMT) THEN(GOTO DONE) (group of CL commands)CHGVAR ampLOOPCTL VALUE(ampLOOPCTL+1)GOTO CHECKDONE
bull New-style coding exampleChecks for loop exit at top of loop (like DOWHILE)
DCL ampLOOPCTL TYPE(INT) LEN(4)DCL ampLOOPLMT TYPE(INT) LEN(4)DOFOR VAR(ampLOOPCTL) FROM(1) TO(ampLOOPLMT) BY(1) (group of CL commands) 1048773 body will be run zero or more timesENDDO
LEAVE and ITERATEbull Allowed only within a DOWHILE DOUNTIL or DOFOR group
bull LEAVE passes control to next CL statement following loop ENDDObull ITERATE passes control to end of loop and tests loop exit condition
bull Both support CMDLBL (Command label) parameter to allowjump out of multiple (nested) loopsndash Both default to CURRENT loopbull Example (group of CL commands)IF (SST(ampNAME 1 10) EQ lsquoNONErsquo) THEN(LEAVE LOOP1)ELSE (DO)IF (SST(ampNAME 11 10) EQ lsquoLIBLrsquo) THEN(ITERATE)ENDDO (group of CL commands)
SELECT Groupbull SELECT starts a ldquoconditionrdquo groupbull ENDSELECT ends group
bull Group must have at least one WHENndash WHEN command has COND and THEN parameters (like IF)bull OTHERWISE (optional) run if no WHEN COND = Truendash OTHERWISE command has only CMD parameter (like ELSE)bull Example
SELECTWHEN COND(ampTYPE EQ CMD) THEN(DO) hellip(group of CL commands)ENDDOWHEN COND(ampTYPE EQ PGM) THEN(DO) helliphellip(group of CL commands)ENDDOhellipOTHERWISE CMD(CHGVAR ampBADTYPE lsquo1rsquo)ENDSELECT
Enhanced File Support
Will support up to 5 file instances using DCLF
bull Instances can be for the same or different files
bull New OPNID (Open identifier) parameter added to
DCLF statement
bull Default for OPNID is NONE
ndashOnly one DCLF allowed with OPNID(NONE)
bull OPNID accepts simple name up to 10 characters
Enhanced File Support (continued)
If OPNID specified declared CL variables areprefixed by this name and an underscore (egampMYTESTFILE_CUSTNAME )bull OPNID added to existing file IO CL commandsndash RCVFndashENDRCVndash SNDFndashSNDRCVFndash WAIT
File variables Identifier qualification
DCLF FILE(STUDENTS) OPNID(STPF) DCLF FILE(STUDDF) OPNID(DSPF) DCL ampEOF LGL 1 CHGVAR ampEOF 0 RCVF OPNID(STPF) DOWHILE (NOT ampDSPF-IN03) CHGVAR ampDSPF-FINESOWED ampSTPF-FINESOWED IF COND(ampDSPF-FEESOWED GT ampSTPF-FEESOWED) +
THEN(CHGVAR ampDSPF-IN30 1) IF COND(ampDSPF-FINESOWED NE ampSTPF-FINESOWED) +
THEN(CHGVAR ampDSPF-IN31 1) SNDRCVF OPNID(DSPF) RCVF OPNID(STPF)
PGM
DCLF FILE(RADIO) RCDFMT(PROMPT) DCL VAR(ampLEN) TYPE(DEC) LEN(2) DCL VAR(ampOPTION) TYPE(CHAR) LEN(50) DCL VAR(ampDIV) TYPE(CHAR) LEN(10) CALLPRC PRC(ASSIGN2B) PARM(ampDIV ampOPTION)
Called program receiving passed parameters
PGM PARM(ampDIVI ampOPTI) DCL VAR(ampDIVI) TYPE(CHAR) LEN(10) DCL VAR(ampOPTI) TYPE(CHAR) LEN(50)
IF (ampDIVI EQ DIVISION2) THEN(DO) OVRDBF FILE(INFILE) TOFILE(QGPLCHAP8AS2) + MBR(DIVISION2) POSITION(START) SHARE(YES) ENDDO OPNQRYF FILE((INFILE)) QRYSLT(ampOPTI) + KEYFLD((EMPNO)) CPYFRMQRYF FROMOPNID(INFILE) TOFILE(QTEMPCHAP8AS2) + MBROPT(REPLACE) CRTFILE(YES)
And passing it further down the line to another program utility or tool
Passing parameters by valuebull CALLPRC (Call Procedure) command
supports calls from ILE CL procedures to other ILE procedures
bull In prior releases CALLPRC only supported passing parameters by reference
bull Can specify BYREF or BYVAL special valuefor each parameter being passed
bull Enables ILE CL to call many MI and C functions and other procedure APIs
bull Maximum numbers of parameters 300
- IBC233
- Agenda
- Slide 3
- Eyes FOCUS - where
- Using ldquoTYPE amp EDITINGrdquo to get what you want
- Lowercase in Display Files
- OPM Call (original program model)
- How it works
- ILE Call (Integrated Language Environment)
- Slide 10
- Slide 11
- Slide 12
- Slide 13
- Advantages of OPM
- Disadvantages of OPM
- Advantages of ILE
- Disadvantages of ILE
- DOWHILE Loop
- DOUNTIL Loop
- DOFOR Loop
- DOFOR Loop (continued)
- LEAVE and ITERATE
- SELECT Group
- Enhanced File Support
- Enhanced File Support (continued)
- File variables Identifier qualification
- Slide 27
- Passing parameters by value
-
DOUNTIL Loop bull Old style coding exampleDCL VAR(ampLGL) TYPE(LGL)LOOP (group of CL commands)IF COND(NOT ampLGL) THEN(GOTO LOOP)
bull New style coding exampleEvaluates COND at bottom of loop
DOUNTIL COND(ampLGL) (group of CL commands) 1048773 body will be run one or more timesENDDO
DOFOR Loopbull SyntaxDOFOR VAR( ) FROM( ) TO( ) BY( )bullbull VAR must be INT or UINT variablebull FROM and TO can be integer constants expressions or
variablesbull BY must be an integer constant (can be negative)
defaults to 1 other parameters are requiredbull FROMTO expressions are evaluated at loop initiation TOevaluated after increment
DOFOR Loop (continued)bull Old-style coding example
DCL ampLOOPCTL TYPE(DEC) LEN(5 0)DCL ampLOOPLMT TYPE(DEC) LEN(5 0)CHGVAR ampLOOPCTL VALUE(1)CHECK IF COND(ampLOOPCTL GT ampLOOPLMT) THEN(GOTO DONE) (group of CL commands)CHGVAR ampLOOPCTL VALUE(ampLOOPCTL+1)GOTO CHECKDONE
bull New-style coding exampleChecks for loop exit at top of loop (like DOWHILE)
DCL ampLOOPCTL TYPE(INT) LEN(4)DCL ampLOOPLMT TYPE(INT) LEN(4)DOFOR VAR(ampLOOPCTL) FROM(1) TO(ampLOOPLMT) BY(1) (group of CL commands) 1048773 body will be run zero or more timesENDDO
LEAVE and ITERATEbull Allowed only within a DOWHILE DOUNTIL or DOFOR group
bull LEAVE passes control to next CL statement following loop ENDDObull ITERATE passes control to end of loop and tests loop exit condition
bull Both support CMDLBL (Command label) parameter to allowjump out of multiple (nested) loopsndash Both default to CURRENT loopbull Example (group of CL commands)IF (SST(ampNAME 1 10) EQ lsquoNONErsquo) THEN(LEAVE LOOP1)ELSE (DO)IF (SST(ampNAME 11 10) EQ lsquoLIBLrsquo) THEN(ITERATE)ENDDO (group of CL commands)
SELECT Groupbull SELECT starts a ldquoconditionrdquo groupbull ENDSELECT ends group
bull Group must have at least one WHENndash WHEN command has COND and THEN parameters (like IF)bull OTHERWISE (optional) run if no WHEN COND = Truendash OTHERWISE command has only CMD parameter (like ELSE)bull Example
SELECTWHEN COND(ampTYPE EQ CMD) THEN(DO) hellip(group of CL commands)ENDDOWHEN COND(ampTYPE EQ PGM) THEN(DO) helliphellip(group of CL commands)ENDDOhellipOTHERWISE CMD(CHGVAR ampBADTYPE lsquo1rsquo)ENDSELECT
Enhanced File Support
Will support up to 5 file instances using DCLF
bull Instances can be for the same or different files
bull New OPNID (Open identifier) parameter added to
DCLF statement
bull Default for OPNID is NONE
ndashOnly one DCLF allowed with OPNID(NONE)
bull OPNID accepts simple name up to 10 characters
Enhanced File Support (continued)
If OPNID specified declared CL variables areprefixed by this name and an underscore (egampMYTESTFILE_CUSTNAME )bull OPNID added to existing file IO CL commandsndash RCVFndashENDRCVndash SNDFndashSNDRCVFndash WAIT
File variables Identifier qualification
DCLF FILE(STUDENTS) OPNID(STPF) DCLF FILE(STUDDF) OPNID(DSPF) DCL ampEOF LGL 1 CHGVAR ampEOF 0 RCVF OPNID(STPF) DOWHILE (NOT ampDSPF-IN03) CHGVAR ampDSPF-FINESOWED ampSTPF-FINESOWED IF COND(ampDSPF-FEESOWED GT ampSTPF-FEESOWED) +
THEN(CHGVAR ampDSPF-IN30 1) IF COND(ampDSPF-FINESOWED NE ampSTPF-FINESOWED) +
THEN(CHGVAR ampDSPF-IN31 1) SNDRCVF OPNID(DSPF) RCVF OPNID(STPF)
PGM
DCLF FILE(RADIO) RCDFMT(PROMPT) DCL VAR(ampLEN) TYPE(DEC) LEN(2) DCL VAR(ampOPTION) TYPE(CHAR) LEN(50) DCL VAR(ampDIV) TYPE(CHAR) LEN(10) CALLPRC PRC(ASSIGN2B) PARM(ampDIV ampOPTION)
Called program receiving passed parameters
PGM PARM(ampDIVI ampOPTI) DCL VAR(ampDIVI) TYPE(CHAR) LEN(10) DCL VAR(ampOPTI) TYPE(CHAR) LEN(50)
IF (ampDIVI EQ DIVISION2) THEN(DO) OVRDBF FILE(INFILE) TOFILE(QGPLCHAP8AS2) + MBR(DIVISION2) POSITION(START) SHARE(YES) ENDDO OPNQRYF FILE((INFILE)) QRYSLT(ampOPTI) + KEYFLD((EMPNO)) CPYFRMQRYF FROMOPNID(INFILE) TOFILE(QTEMPCHAP8AS2) + MBROPT(REPLACE) CRTFILE(YES)
And passing it further down the line to another program utility or tool
Passing parameters by valuebull CALLPRC (Call Procedure) command
supports calls from ILE CL procedures to other ILE procedures
bull In prior releases CALLPRC only supported passing parameters by reference
bull Can specify BYREF or BYVAL special valuefor each parameter being passed
bull Enables ILE CL to call many MI and C functions and other procedure APIs
bull Maximum numbers of parameters 300
- IBC233
- Agenda
- Slide 3
- Eyes FOCUS - where
- Using ldquoTYPE amp EDITINGrdquo to get what you want
- Lowercase in Display Files
- OPM Call (original program model)
- How it works
- ILE Call (Integrated Language Environment)
- Slide 10
- Slide 11
- Slide 12
- Slide 13
- Advantages of OPM
- Disadvantages of OPM
- Advantages of ILE
- Disadvantages of ILE
- DOWHILE Loop
- DOUNTIL Loop
- DOFOR Loop
- DOFOR Loop (continued)
- LEAVE and ITERATE
- SELECT Group
- Enhanced File Support
- Enhanced File Support (continued)
- File variables Identifier qualification
- Slide 27
- Passing parameters by value
-
DOFOR Loopbull SyntaxDOFOR VAR( ) FROM( ) TO( ) BY( )bullbull VAR must be INT or UINT variablebull FROM and TO can be integer constants expressions or
variablesbull BY must be an integer constant (can be negative)
defaults to 1 other parameters are requiredbull FROMTO expressions are evaluated at loop initiation TOevaluated after increment
DOFOR Loop (continued)bull Old-style coding example
DCL ampLOOPCTL TYPE(DEC) LEN(5 0)DCL ampLOOPLMT TYPE(DEC) LEN(5 0)CHGVAR ampLOOPCTL VALUE(1)CHECK IF COND(ampLOOPCTL GT ampLOOPLMT) THEN(GOTO DONE) (group of CL commands)CHGVAR ampLOOPCTL VALUE(ampLOOPCTL+1)GOTO CHECKDONE
bull New-style coding exampleChecks for loop exit at top of loop (like DOWHILE)
DCL ampLOOPCTL TYPE(INT) LEN(4)DCL ampLOOPLMT TYPE(INT) LEN(4)DOFOR VAR(ampLOOPCTL) FROM(1) TO(ampLOOPLMT) BY(1) (group of CL commands) 1048773 body will be run zero or more timesENDDO
LEAVE and ITERATEbull Allowed only within a DOWHILE DOUNTIL or DOFOR group
bull LEAVE passes control to next CL statement following loop ENDDObull ITERATE passes control to end of loop and tests loop exit condition
bull Both support CMDLBL (Command label) parameter to allowjump out of multiple (nested) loopsndash Both default to CURRENT loopbull Example (group of CL commands)IF (SST(ampNAME 1 10) EQ lsquoNONErsquo) THEN(LEAVE LOOP1)ELSE (DO)IF (SST(ampNAME 11 10) EQ lsquoLIBLrsquo) THEN(ITERATE)ENDDO (group of CL commands)
SELECT Groupbull SELECT starts a ldquoconditionrdquo groupbull ENDSELECT ends group
bull Group must have at least one WHENndash WHEN command has COND and THEN parameters (like IF)bull OTHERWISE (optional) run if no WHEN COND = Truendash OTHERWISE command has only CMD parameter (like ELSE)bull Example
SELECTWHEN COND(ampTYPE EQ CMD) THEN(DO) hellip(group of CL commands)ENDDOWHEN COND(ampTYPE EQ PGM) THEN(DO) helliphellip(group of CL commands)ENDDOhellipOTHERWISE CMD(CHGVAR ampBADTYPE lsquo1rsquo)ENDSELECT
Enhanced File Support
Will support up to 5 file instances using DCLF
bull Instances can be for the same or different files
bull New OPNID (Open identifier) parameter added to
DCLF statement
bull Default for OPNID is NONE
ndashOnly one DCLF allowed with OPNID(NONE)
bull OPNID accepts simple name up to 10 characters
Enhanced File Support (continued)
If OPNID specified declared CL variables areprefixed by this name and an underscore (egampMYTESTFILE_CUSTNAME )bull OPNID added to existing file IO CL commandsndash RCVFndashENDRCVndash SNDFndashSNDRCVFndash WAIT
File variables Identifier qualification
DCLF FILE(STUDENTS) OPNID(STPF) DCLF FILE(STUDDF) OPNID(DSPF) DCL ampEOF LGL 1 CHGVAR ampEOF 0 RCVF OPNID(STPF) DOWHILE (NOT ampDSPF-IN03) CHGVAR ampDSPF-FINESOWED ampSTPF-FINESOWED IF COND(ampDSPF-FEESOWED GT ampSTPF-FEESOWED) +
THEN(CHGVAR ampDSPF-IN30 1) IF COND(ampDSPF-FINESOWED NE ampSTPF-FINESOWED) +
THEN(CHGVAR ampDSPF-IN31 1) SNDRCVF OPNID(DSPF) RCVF OPNID(STPF)
PGM
DCLF FILE(RADIO) RCDFMT(PROMPT) DCL VAR(ampLEN) TYPE(DEC) LEN(2) DCL VAR(ampOPTION) TYPE(CHAR) LEN(50) DCL VAR(ampDIV) TYPE(CHAR) LEN(10) CALLPRC PRC(ASSIGN2B) PARM(ampDIV ampOPTION)
Called program receiving passed parameters
PGM PARM(ampDIVI ampOPTI) DCL VAR(ampDIVI) TYPE(CHAR) LEN(10) DCL VAR(ampOPTI) TYPE(CHAR) LEN(50)
IF (ampDIVI EQ DIVISION2) THEN(DO) OVRDBF FILE(INFILE) TOFILE(QGPLCHAP8AS2) + MBR(DIVISION2) POSITION(START) SHARE(YES) ENDDO OPNQRYF FILE((INFILE)) QRYSLT(ampOPTI) + KEYFLD((EMPNO)) CPYFRMQRYF FROMOPNID(INFILE) TOFILE(QTEMPCHAP8AS2) + MBROPT(REPLACE) CRTFILE(YES)
And passing it further down the line to another program utility or tool
Passing parameters by valuebull CALLPRC (Call Procedure) command
supports calls from ILE CL procedures to other ILE procedures
bull In prior releases CALLPRC only supported passing parameters by reference
bull Can specify BYREF or BYVAL special valuefor each parameter being passed
bull Enables ILE CL to call many MI and C functions and other procedure APIs
bull Maximum numbers of parameters 300
- IBC233
- Agenda
- Slide 3
- Eyes FOCUS - where
- Using ldquoTYPE amp EDITINGrdquo to get what you want
- Lowercase in Display Files
- OPM Call (original program model)
- How it works
- ILE Call (Integrated Language Environment)
- Slide 10
- Slide 11
- Slide 12
- Slide 13
- Advantages of OPM
- Disadvantages of OPM
- Advantages of ILE
- Disadvantages of ILE
- DOWHILE Loop
- DOUNTIL Loop
- DOFOR Loop
- DOFOR Loop (continued)
- LEAVE and ITERATE
- SELECT Group
- Enhanced File Support
- Enhanced File Support (continued)
- File variables Identifier qualification
- Slide 27
- Passing parameters by value
-
DOFOR Loop (continued)bull Old-style coding example
DCL ampLOOPCTL TYPE(DEC) LEN(5 0)DCL ampLOOPLMT TYPE(DEC) LEN(5 0)CHGVAR ampLOOPCTL VALUE(1)CHECK IF COND(ampLOOPCTL GT ampLOOPLMT) THEN(GOTO DONE) (group of CL commands)CHGVAR ampLOOPCTL VALUE(ampLOOPCTL+1)GOTO CHECKDONE
bull New-style coding exampleChecks for loop exit at top of loop (like DOWHILE)
DCL ampLOOPCTL TYPE(INT) LEN(4)DCL ampLOOPLMT TYPE(INT) LEN(4)DOFOR VAR(ampLOOPCTL) FROM(1) TO(ampLOOPLMT) BY(1) (group of CL commands) 1048773 body will be run zero or more timesENDDO
LEAVE and ITERATEbull Allowed only within a DOWHILE DOUNTIL or DOFOR group
bull LEAVE passes control to next CL statement following loop ENDDObull ITERATE passes control to end of loop and tests loop exit condition
bull Both support CMDLBL (Command label) parameter to allowjump out of multiple (nested) loopsndash Both default to CURRENT loopbull Example (group of CL commands)IF (SST(ampNAME 1 10) EQ lsquoNONErsquo) THEN(LEAVE LOOP1)ELSE (DO)IF (SST(ampNAME 11 10) EQ lsquoLIBLrsquo) THEN(ITERATE)ENDDO (group of CL commands)
SELECT Groupbull SELECT starts a ldquoconditionrdquo groupbull ENDSELECT ends group
bull Group must have at least one WHENndash WHEN command has COND and THEN parameters (like IF)bull OTHERWISE (optional) run if no WHEN COND = Truendash OTHERWISE command has only CMD parameter (like ELSE)bull Example
SELECTWHEN COND(ampTYPE EQ CMD) THEN(DO) hellip(group of CL commands)ENDDOWHEN COND(ampTYPE EQ PGM) THEN(DO) helliphellip(group of CL commands)ENDDOhellipOTHERWISE CMD(CHGVAR ampBADTYPE lsquo1rsquo)ENDSELECT
Enhanced File Support
Will support up to 5 file instances using DCLF
bull Instances can be for the same or different files
bull New OPNID (Open identifier) parameter added to
DCLF statement
bull Default for OPNID is NONE
ndashOnly one DCLF allowed with OPNID(NONE)
bull OPNID accepts simple name up to 10 characters
Enhanced File Support (continued)
If OPNID specified declared CL variables areprefixed by this name and an underscore (egampMYTESTFILE_CUSTNAME )bull OPNID added to existing file IO CL commandsndash RCVFndashENDRCVndash SNDFndashSNDRCVFndash WAIT
File variables Identifier qualification
DCLF FILE(STUDENTS) OPNID(STPF) DCLF FILE(STUDDF) OPNID(DSPF) DCL ampEOF LGL 1 CHGVAR ampEOF 0 RCVF OPNID(STPF) DOWHILE (NOT ampDSPF-IN03) CHGVAR ampDSPF-FINESOWED ampSTPF-FINESOWED IF COND(ampDSPF-FEESOWED GT ampSTPF-FEESOWED) +
THEN(CHGVAR ampDSPF-IN30 1) IF COND(ampDSPF-FINESOWED NE ampSTPF-FINESOWED) +
THEN(CHGVAR ampDSPF-IN31 1) SNDRCVF OPNID(DSPF) RCVF OPNID(STPF)
PGM
DCLF FILE(RADIO) RCDFMT(PROMPT) DCL VAR(ampLEN) TYPE(DEC) LEN(2) DCL VAR(ampOPTION) TYPE(CHAR) LEN(50) DCL VAR(ampDIV) TYPE(CHAR) LEN(10) CALLPRC PRC(ASSIGN2B) PARM(ampDIV ampOPTION)
Called program receiving passed parameters
PGM PARM(ampDIVI ampOPTI) DCL VAR(ampDIVI) TYPE(CHAR) LEN(10) DCL VAR(ampOPTI) TYPE(CHAR) LEN(50)
IF (ampDIVI EQ DIVISION2) THEN(DO) OVRDBF FILE(INFILE) TOFILE(QGPLCHAP8AS2) + MBR(DIVISION2) POSITION(START) SHARE(YES) ENDDO OPNQRYF FILE((INFILE)) QRYSLT(ampOPTI) + KEYFLD((EMPNO)) CPYFRMQRYF FROMOPNID(INFILE) TOFILE(QTEMPCHAP8AS2) + MBROPT(REPLACE) CRTFILE(YES)
And passing it further down the line to another program utility or tool
Passing parameters by valuebull CALLPRC (Call Procedure) command
supports calls from ILE CL procedures to other ILE procedures
bull In prior releases CALLPRC only supported passing parameters by reference
bull Can specify BYREF or BYVAL special valuefor each parameter being passed
bull Enables ILE CL to call many MI and C functions and other procedure APIs
bull Maximum numbers of parameters 300
- IBC233
- Agenda
- Slide 3
- Eyes FOCUS - where
- Using ldquoTYPE amp EDITINGrdquo to get what you want
- Lowercase in Display Files
- OPM Call (original program model)
- How it works
- ILE Call (Integrated Language Environment)
- Slide 10
- Slide 11
- Slide 12
- Slide 13
- Advantages of OPM
- Disadvantages of OPM
- Advantages of ILE
- Disadvantages of ILE
- DOWHILE Loop
- DOUNTIL Loop
- DOFOR Loop
- DOFOR Loop (continued)
- LEAVE and ITERATE
- SELECT Group
- Enhanced File Support
- Enhanced File Support (continued)
- File variables Identifier qualification
- Slide 27
- Passing parameters by value
-
LEAVE and ITERATEbull Allowed only within a DOWHILE DOUNTIL or DOFOR group
bull LEAVE passes control to next CL statement following loop ENDDObull ITERATE passes control to end of loop and tests loop exit condition
bull Both support CMDLBL (Command label) parameter to allowjump out of multiple (nested) loopsndash Both default to CURRENT loopbull Example (group of CL commands)IF (SST(ampNAME 1 10) EQ lsquoNONErsquo) THEN(LEAVE LOOP1)ELSE (DO)IF (SST(ampNAME 11 10) EQ lsquoLIBLrsquo) THEN(ITERATE)ENDDO (group of CL commands)
SELECT Groupbull SELECT starts a ldquoconditionrdquo groupbull ENDSELECT ends group
bull Group must have at least one WHENndash WHEN command has COND and THEN parameters (like IF)bull OTHERWISE (optional) run if no WHEN COND = Truendash OTHERWISE command has only CMD parameter (like ELSE)bull Example
SELECTWHEN COND(ampTYPE EQ CMD) THEN(DO) hellip(group of CL commands)ENDDOWHEN COND(ampTYPE EQ PGM) THEN(DO) helliphellip(group of CL commands)ENDDOhellipOTHERWISE CMD(CHGVAR ampBADTYPE lsquo1rsquo)ENDSELECT
Enhanced File Support
Will support up to 5 file instances using DCLF
bull Instances can be for the same or different files
bull New OPNID (Open identifier) parameter added to
DCLF statement
bull Default for OPNID is NONE
ndashOnly one DCLF allowed with OPNID(NONE)
bull OPNID accepts simple name up to 10 characters
Enhanced File Support (continued)
If OPNID specified declared CL variables areprefixed by this name and an underscore (egampMYTESTFILE_CUSTNAME )bull OPNID added to existing file IO CL commandsndash RCVFndashENDRCVndash SNDFndashSNDRCVFndash WAIT
File variables Identifier qualification
DCLF FILE(STUDENTS) OPNID(STPF) DCLF FILE(STUDDF) OPNID(DSPF) DCL ampEOF LGL 1 CHGVAR ampEOF 0 RCVF OPNID(STPF) DOWHILE (NOT ampDSPF-IN03) CHGVAR ampDSPF-FINESOWED ampSTPF-FINESOWED IF COND(ampDSPF-FEESOWED GT ampSTPF-FEESOWED) +
THEN(CHGVAR ampDSPF-IN30 1) IF COND(ampDSPF-FINESOWED NE ampSTPF-FINESOWED) +
THEN(CHGVAR ampDSPF-IN31 1) SNDRCVF OPNID(DSPF) RCVF OPNID(STPF)
PGM
DCLF FILE(RADIO) RCDFMT(PROMPT) DCL VAR(ampLEN) TYPE(DEC) LEN(2) DCL VAR(ampOPTION) TYPE(CHAR) LEN(50) DCL VAR(ampDIV) TYPE(CHAR) LEN(10) CALLPRC PRC(ASSIGN2B) PARM(ampDIV ampOPTION)
Called program receiving passed parameters
PGM PARM(ampDIVI ampOPTI) DCL VAR(ampDIVI) TYPE(CHAR) LEN(10) DCL VAR(ampOPTI) TYPE(CHAR) LEN(50)
IF (ampDIVI EQ DIVISION2) THEN(DO) OVRDBF FILE(INFILE) TOFILE(QGPLCHAP8AS2) + MBR(DIVISION2) POSITION(START) SHARE(YES) ENDDO OPNQRYF FILE((INFILE)) QRYSLT(ampOPTI) + KEYFLD((EMPNO)) CPYFRMQRYF FROMOPNID(INFILE) TOFILE(QTEMPCHAP8AS2) + MBROPT(REPLACE) CRTFILE(YES)
And passing it further down the line to another program utility or tool
Passing parameters by valuebull CALLPRC (Call Procedure) command
supports calls from ILE CL procedures to other ILE procedures
bull In prior releases CALLPRC only supported passing parameters by reference
bull Can specify BYREF or BYVAL special valuefor each parameter being passed
bull Enables ILE CL to call many MI and C functions and other procedure APIs
bull Maximum numbers of parameters 300
- IBC233
- Agenda
- Slide 3
- Eyes FOCUS - where
- Using ldquoTYPE amp EDITINGrdquo to get what you want
- Lowercase in Display Files
- OPM Call (original program model)
- How it works
- ILE Call (Integrated Language Environment)
- Slide 10
- Slide 11
- Slide 12
- Slide 13
- Advantages of OPM
- Disadvantages of OPM
- Advantages of ILE
- Disadvantages of ILE
- DOWHILE Loop
- DOUNTIL Loop
- DOFOR Loop
- DOFOR Loop (continued)
- LEAVE and ITERATE
- SELECT Group
- Enhanced File Support
- Enhanced File Support (continued)
- File variables Identifier qualification
- Slide 27
- Passing parameters by value
-
SELECT Groupbull SELECT starts a ldquoconditionrdquo groupbull ENDSELECT ends group
bull Group must have at least one WHENndash WHEN command has COND and THEN parameters (like IF)bull OTHERWISE (optional) run if no WHEN COND = Truendash OTHERWISE command has only CMD parameter (like ELSE)bull Example
SELECTWHEN COND(ampTYPE EQ CMD) THEN(DO) hellip(group of CL commands)ENDDOWHEN COND(ampTYPE EQ PGM) THEN(DO) helliphellip(group of CL commands)ENDDOhellipOTHERWISE CMD(CHGVAR ampBADTYPE lsquo1rsquo)ENDSELECT
Enhanced File Support
Will support up to 5 file instances using DCLF
bull Instances can be for the same or different files
bull New OPNID (Open identifier) parameter added to
DCLF statement
bull Default for OPNID is NONE
ndashOnly one DCLF allowed with OPNID(NONE)
bull OPNID accepts simple name up to 10 characters
Enhanced File Support (continued)
If OPNID specified declared CL variables areprefixed by this name and an underscore (egampMYTESTFILE_CUSTNAME )bull OPNID added to existing file IO CL commandsndash RCVFndashENDRCVndash SNDFndashSNDRCVFndash WAIT
File variables Identifier qualification
DCLF FILE(STUDENTS) OPNID(STPF) DCLF FILE(STUDDF) OPNID(DSPF) DCL ampEOF LGL 1 CHGVAR ampEOF 0 RCVF OPNID(STPF) DOWHILE (NOT ampDSPF-IN03) CHGVAR ampDSPF-FINESOWED ampSTPF-FINESOWED IF COND(ampDSPF-FEESOWED GT ampSTPF-FEESOWED) +
THEN(CHGVAR ampDSPF-IN30 1) IF COND(ampDSPF-FINESOWED NE ampSTPF-FINESOWED) +
THEN(CHGVAR ampDSPF-IN31 1) SNDRCVF OPNID(DSPF) RCVF OPNID(STPF)
PGM
DCLF FILE(RADIO) RCDFMT(PROMPT) DCL VAR(ampLEN) TYPE(DEC) LEN(2) DCL VAR(ampOPTION) TYPE(CHAR) LEN(50) DCL VAR(ampDIV) TYPE(CHAR) LEN(10) CALLPRC PRC(ASSIGN2B) PARM(ampDIV ampOPTION)
Called program receiving passed parameters
PGM PARM(ampDIVI ampOPTI) DCL VAR(ampDIVI) TYPE(CHAR) LEN(10) DCL VAR(ampOPTI) TYPE(CHAR) LEN(50)
IF (ampDIVI EQ DIVISION2) THEN(DO) OVRDBF FILE(INFILE) TOFILE(QGPLCHAP8AS2) + MBR(DIVISION2) POSITION(START) SHARE(YES) ENDDO OPNQRYF FILE((INFILE)) QRYSLT(ampOPTI) + KEYFLD((EMPNO)) CPYFRMQRYF FROMOPNID(INFILE) TOFILE(QTEMPCHAP8AS2) + MBROPT(REPLACE) CRTFILE(YES)
And passing it further down the line to another program utility or tool
Passing parameters by valuebull CALLPRC (Call Procedure) command
supports calls from ILE CL procedures to other ILE procedures
bull In prior releases CALLPRC only supported passing parameters by reference
bull Can specify BYREF or BYVAL special valuefor each parameter being passed
bull Enables ILE CL to call many MI and C functions and other procedure APIs
bull Maximum numbers of parameters 300
- IBC233
- Agenda
- Slide 3
- Eyes FOCUS - where
- Using ldquoTYPE amp EDITINGrdquo to get what you want
- Lowercase in Display Files
- OPM Call (original program model)
- How it works
- ILE Call (Integrated Language Environment)
- Slide 10
- Slide 11
- Slide 12
- Slide 13
- Advantages of OPM
- Disadvantages of OPM
- Advantages of ILE
- Disadvantages of ILE
- DOWHILE Loop
- DOUNTIL Loop
- DOFOR Loop
- DOFOR Loop (continued)
- LEAVE and ITERATE
- SELECT Group
- Enhanced File Support
- Enhanced File Support (continued)
- File variables Identifier qualification
- Slide 27
- Passing parameters by value
-
Enhanced File Support
Will support up to 5 file instances using DCLF
bull Instances can be for the same or different files
bull New OPNID (Open identifier) parameter added to
DCLF statement
bull Default for OPNID is NONE
ndashOnly one DCLF allowed with OPNID(NONE)
bull OPNID accepts simple name up to 10 characters
Enhanced File Support (continued)
If OPNID specified declared CL variables areprefixed by this name and an underscore (egampMYTESTFILE_CUSTNAME )bull OPNID added to existing file IO CL commandsndash RCVFndashENDRCVndash SNDFndashSNDRCVFndash WAIT
File variables Identifier qualification
DCLF FILE(STUDENTS) OPNID(STPF) DCLF FILE(STUDDF) OPNID(DSPF) DCL ampEOF LGL 1 CHGVAR ampEOF 0 RCVF OPNID(STPF) DOWHILE (NOT ampDSPF-IN03) CHGVAR ampDSPF-FINESOWED ampSTPF-FINESOWED IF COND(ampDSPF-FEESOWED GT ampSTPF-FEESOWED) +
THEN(CHGVAR ampDSPF-IN30 1) IF COND(ampDSPF-FINESOWED NE ampSTPF-FINESOWED) +
THEN(CHGVAR ampDSPF-IN31 1) SNDRCVF OPNID(DSPF) RCVF OPNID(STPF)
PGM
DCLF FILE(RADIO) RCDFMT(PROMPT) DCL VAR(ampLEN) TYPE(DEC) LEN(2) DCL VAR(ampOPTION) TYPE(CHAR) LEN(50) DCL VAR(ampDIV) TYPE(CHAR) LEN(10) CALLPRC PRC(ASSIGN2B) PARM(ampDIV ampOPTION)
Called program receiving passed parameters
PGM PARM(ampDIVI ampOPTI) DCL VAR(ampDIVI) TYPE(CHAR) LEN(10) DCL VAR(ampOPTI) TYPE(CHAR) LEN(50)
IF (ampDIVI EQ DIVISION2) THEN(DO) OVRDBF FILE(INFILE) TOFILE(QGPLCHAP8AS2) + MBR(DIVISION2) POSITION(START) SHARE(YES) ENDDO OPNQRYF FILE((INFILE)) QRYSLT(ampOPTI) + KEYFLD((EMPNO)) CPYFRMQRYF FROMOPNID(INFILE) TOFILE(QTEMPCHAP8AS2) + MBROPT(REPLACE) CRTFILE(YES)
And passing it further down the line to another program utility or tool
Passing parameters by valuebull CALLPRC (Call Procedure) command
supports calls from ILE CL procedures to other ILE procedures
bull In prior releases CALLPRC only supported passing parameters by reference
bull Can specify BYREF or BYVAL special valuefor each parameter being passed
bull Enables ILE CL to call many MI and C functions and other procedure APIs
bull Maximum numbers of parameters 300
- IBC233
- Agenda
- Slide 3
- Eyes FOCUS - where
- Using ldquoTYPE amp EDITINGrdquo to get what you want
- Lowercase in Display Files
- OPM Call (original program model)
- How it works
- ILE Call (Integrated Language Environment)
- Slide 10
- Slide 11
- Slide 12
- Slide 13
- Advantages of OPM
- Disadvantages of OPM
- Advantages of ILE
- Disadvantages of ILE
- DOWHILE Loop
- DOUNTIL Loop
- DOFOR Loop
- DOFOR Loop (continued)
- LEAVE and ITERATE
- SELECT Group
- Enhanced File Support
- Enhanced File Support (continued)
- File variables Identifier qualification
- Slide 27
- Passing parameters by value
-
Enhanced File Support (continued)
If OPNID specified declared CL variables areprefixed by this name and an underscore (egampMYTESTFILE_CUSTNAME )bull OPNID added to existing file IO CL commandsndash RCVFndashENDRCVndash SNDFndashSNDRCVFndash WAIT
File variables Identifier qualification
DCLF FILE(STUDENTS) OPNID(STPF) DCLF FILE(STUDDF) OPNID(DSPF) DCL ampEOF LGL 1 CHGVAR ampEOF 0 RCVF OPNID(STPF) DOWHILE (NOT ampDSPF-IN03) CHGVAR ampDSPF-FINESOWED ampSTPF-FINESOWED IF COND(ampDSPF-FEESOWED GT ampSTPF-FEESOWED) +
THEN(CHGVAR ampDSPF-IN30 1) IF COND(ampDSPF-FINESOWED NE ampSTPF-FINESOWED) +
THEN(CHGVAR ampDSPF-IN31 1) SNDRCVF OPNID(DSPF) RCVF OPNID(STPF)
PGM
DCLF FILE(RADIO) RCDFMT(PROMPT) DCL VAR(ampLEN) TYPE(DEC) LEN(2) DCL VAR(ampOPTION) TYPE(CHAR) LEN(50) DCL VAR(ampDIV) TYPE(CHAR) LEN(10) CALLPRC PRC(ASSIGN2B) PARM(ampDIV ampOPTION)
Called program receiving passed parameters
PGM PARM(ampDIVI ampOPTI) DCL VAR(ampDIVI) TYPE(CHAR) LEN(10) DCL VAR(ampOPTI) TYPE(CHAR) LEN(50)
IF (ampDIVI EQ DIVISION2) THEN(DO) OVRDBF FILE(INFILE) TOFILE(QGPLCHAP8AS2) + MBR(DIVISION2) POSITION(START) SHARE(YES) ENDDO OPNQRYF FILE((INFILE)) QRYSLT(ampOPTI) + KEYFLD((EMPNO)) CPYFRMQRYF FROMOPNID(INFILE) TOFILE(QTEMPCHAP8AS2) + MBROPT(REPLACE) CRTFILE(YES)
And passing it further down the line to another program utility or tool
Passing parameters by valuebull CALLPRC (Call Procedure) command
supports calls from ILE CL procedures to other ILE procedures
bull In prior releases CALLPRC only supported passing parameters by reference
bull Can specify BYREF or BYVAL special valuefor each parameter being passed
bull Enables ILE CL to call many MI and C functions and other procedure APIs
bull Maximum numbers of parameters 300
- IBC233
- Agenda
- Slide 3
- Eyes FOCUS - where
- Using ldquoTYPE amp EDITINGrdquo to get what you want
- Lowercase in Display Files
- OPM Call (original program model)
- How it works
- ILE Call (Integrated Language Environment)
- Slide 10
- Slide 11
- Slide 12
- Slide 13
- Advantages of OPM
- Disadvantages of OPM
- Advantages of ILE
- Disadvantages of ILE
- DOWHILE Loop
- DOUNTIL Loop
- DOFOR Loop
- DOFOR Loop (continued)
- LEAVE and ITERATE
- SELECT Group
- Enhanced File Support
- Enhanced File Support (continued)
- File variables Identifier qualification
- Slide 27
- Passing parameters by value
-
File variables Identifier qualification
DCLF FILE(STUDENTS) OPNID(STPF) DCLF FILE(STUDDF) OPNID(DSPF) DCL ampEOF LGL 1 CHGVAR ampEOF 0 RCVF OPNID(STPF) DOWHILE (NOT ampDSPF-IN03) CHGVAR ampDSPF-FINESOWED ampSTPF-FINESOWED IF COND(ampDSPF-FEESOWED GT ampSTPF-FEESOWED) +
THEN(CHGVAR ampDSPF-IN30 1) IF COND(ampDSPF-FINESOWED NE ampSTPF-FINESOWED) +
THEN(CHGVAR ampDSPF-IN31 1) SNDRCVF OPNID(DSPF) RCVF OPNID(STPF)
PGM
DCLF FILE(RADIO) RCDFMT(PROMPT) DCL VAR(ampLEN) TYPE(DEC) LEN(2) DCL VAR(ampOPTION) TYPE(CHAR) LEN(50) DCL VAR(ampDIV) TYPE(CHAR) LEN(10) CALLPRC PRC(ASSIGN2B) PARM(ampDIV ampOPTION)
Called program receiving passed parameters
PGM PARM(ampDIVI ampOPTI) DCL VAR(ampDIVI) TYPE(CHAR) LEN(10) DCL VAR(ampOPTI) TYPE(CHAR) LEN(50)
IF (ampDIVI EQ DIVISION2) THEN(DO) OVRDBF FILE(INFILE) TOFILE(QGPLCHAP8AS2) + MBR(DIVISION2) POSITION(START) SHARE(YES) ENDDO OPNQRYF FILE((INFILE)) QRYSLT(ampOPTI) + KEYFLD((EMPNO)) CPYFRMQRYF FROMOPNID(INFILE) TOFILE(QTEMPCHAP8AS2) + MBROPT(REPLACE) CRTFILE(YES)
And passing it further down the line to another program utility or tool
Passing parameters by valuebull CALLPRC (Call Procedure) command
supports calls from ILE CL procedures to other ILE procedures
bull In prior releases CALLPRC only supported passing parameters by reference
bull Can specify BYREF or BYVAL special valuefor each parameter being passed
bull Enables ILE CL to call many MI and C functions and other procedure APIs
bull Maximum numbers of parameters 300
- IBC233
- Agenda
- Slide 3
- Eyes FOCUS - where
- Using ldquoTYPE amp EDITINGrdquo to get what you want
- Lowercase in Display Files
- OPM Call (original program model)
- How it works
- ILE Call (Integrated Language Environment)
- Slide 10
- Slide 11
- Slide 12
- Slide 13
- Advantages of OPM
- Disadvantages of OPM
- Advantages of ILE
- Disadvantages of ILE
- DOWHILE Loop
- DOUNTIL Loop
- DOFOR Loop
- DOFOR Loop (continued)
- LEAVE and ITERATE
- SELECT Group
- Enhanced File Support
- Enhanced File Support (continued)
- File variables Identifier qualification
- Slide 27
- Passing parameters by value
-
PGM
DCLF FILE(RADIO) RCDFMT(PROMPT) DCL VAR(ampLEN) TYPE(DEC) LEN(2) DCL VAR(ampOPTION) TYPE(CHAR) LEN(50) DCL VAR(ampDIV) TYPE(CHAR) LEN(10) CALLPRC PRC(ASSIGN2B) PARM(ampDIV ampOPTION)
Called program receiving passed parameters
PGM PARM(ampDIVI ampOPTI) DCL VAR(ampDIVI) TYPE(CHAR) LEN(10) DCL VAR(ampOPTI) TYPE(CHAR) LEN(50)
IF (ampDIVI EQ DIVISION2) THEN(DO) OVRDBF FILE(INFILE) TOFILE(QGPLCHAP8AS2) + MBR(DIVISION2) POSITION(START) SHARE(YES) ENDDO OPNQRYF FILE((INFILE)) QRYSLT(ampOPTI) + KEYFLD((EMPNO)) CPYFRMQRYF FROMOPNID(INFILE) TOFILE(QTEMPCHAP8AS2) + MBROPT(REPLACE) CRTFILE(YES)
And passing it further down the line to another program utility or tool
Passing parameters by valuebull CALLPRC (Call Procedure) command
supports calls from ILE CL procedures to other ILE procedures
bull In prior releases CALLPRC only supported passing parameters by reference
bull Can specify BYREF or BYVAL special valuefor each parameter being passed
bull Enables ILE CL to call many MI and C functions and other procedure APIs
bull Maximum numbers of parameters 300
- IBC233
- Agenda
- Slide 3
- Eyes FOCUS - where
- Using ldquoTYPE amp EDITINGrdquo to get what you want
- Lowercase in Display Files
- OPM Call (original program model)
- How it works
- ILE Call (Integrated Language Environment)
- Slide 10
- Slide 11
- Slide 12
- Slide 13
- Advantages of OPM
- Disadvantages of OPM
- Advantages of ILE
- Disadvantages of ILE
- DOWHILE Loop
- DOUNTIL Loop
- DOFOR Loop
- DOFOR Loop (continued)
- LEAVE and ITERATE
- SELECT Group
- Enhanced File Support
- Enhanced File Support (continued)
- File variables Identifier qualification
- Slide 27
- Passing parameters by value
-
Passing parameters by valuebull CALLPRC (Call Procedure) command
supports calls from ILE CL procedures to other ILE procedures
bull In prior releases CALLPRC only supported passing parameters by reference
bull Can specify BYREF or BYVAL special valuefor each parameter being passed
bull Enables ILE CL to call many MI and C functions and other procedure APIs
bull Maximum numbers of parameters 300
- IBC233
- Agenda
- Slide 3
- Eyes FOCUS - where
- Using ldquoTYPE amp EDITINGrdquo to get what you want
- Lowercase in Display Files
- OPM Call (original program model)
- How it works
- ILE Call (Integrated Language Environment)
- Slide 10
- Slide 11
- Slide 12
- Slide 13
- Advantages of OPM
- Disadvantages of OPM
- Advantages of ILE
- Disadvantages of ILE
- DOWHILE Loop
- DOUNTIL Loop
- DOFOR Loop
- DOFOR Loop (continued)
- LEAVE and ITERATE
- SELECT Group
- Enhanced File Support
- Enhanced File Support (continued)
- File variables Identifier qualification
- Slide 27
- Passing parameters by value
-