Thursday, October 30, 2008

LANSA and V6R1M0 for Power System i

With V6R1M0 looming on the horizon, rebuilding your LANSA iSeries applications can be done programmatically with a few simple programs. Here at Rippe & Kingston we used the LANSA built-in commands of MAKE_FILE_OPERATIONL and COMPILE_PROCESS to rebuild our System i applications.

With the MAKE_FILE_OPERATIONL built-in, you can recompile all your file I/O modules. There is a little work up front to create a file with all the file names, but a query over file DC@F12 can give you the file and library data. You then copy the queried data into a LANSA defined file and you are ready to run. The code might look something like this:

********** Process all identified files.
SELECT FIELDS((#LIBNAM) (#FILNAM)) FROM_FILE(MAKEFLS)
**********
********** Submit job to make file operational
USE BUILTIN(MAKE_FILE_OPERATIONL) WITH_ARGS(#FILNAM #LIBNAM NNY) TO_GET(#RETCOD)
**********
ENDSELECT



The COMPILE_PROCESS built-in will allow you to recompile all your processes and functions. There is a little work up front here as well to create a file with all the process and function names, but a query over file DC@F23 will give you this data. You then copy the queried data into a LANSA defined file and you are ready to run. The code might look something like this:

********** Define a Process and Function working list
DEF_LIST NAME(#WKPRCL) FIELDS((#PRCN)) TYPE(*WORKING) ENTRYS(500)
DEF_LIST NAME(#WKFUNL) FIELDS((#FCTNAM)) TYPE(*WORKING) ENTRYS(90)
**********
CLR_LIST NAMED(#WKPRCL)
**********
********** Load all the unique Process Names into the working list
SELECT FIELDS((#PRCNAM)) FROM_FILE(PROCFIL)
LOC_ENTRY IN_LIST(#WKPRCL) WHERE('#PRCNAM *EQ #PRCN')
IF_STATUS IS_NOT(*OKAY)
CHANGE FIELD(#PRCN) TO(#PRCNAM)
ADD_ENTRY TO_LIST(#WKPRCL)
ENDIF
ENDSELECT
**********
********** Run through the Process List to build the related
********** Function working list and submit the compiles
SELECTLIST NAMED(#WKPRCL)
**********
CLR_LIST NAMED(#WKFUNL)
**********
SELECT FIELDS((#FCTNAM)) FROM_FILE(PROCFIL) WITH_KEY(#PRCN)
ADD_ENTRY TO_LIST(#WKFUNL)
ENDSELECT
**********
********** Submit the Process/Function compile
USE BUILTIN(COMPILE_PROCESS) WITH_ARGS(#PRCN #WKFUNL) TO_GET(#RETCOD)
********** Check if submission was successful
IF COND('#RETCOD *NE ''OK''')
MESSAGE MSGTXT('Process Compile NOT submitted successfully')
ENDIF
**********
ENDSELECT


One note, it is always best to make sure the submitted jobs go to a single threaded job queue so that compile locks are not a problem.

If you need a little help, don’t hesitate to contact us! It is FREE.

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.