| The API Corner: More on Customizing Application Behavior for Each User |
|
|
|
| Programming - APIs | ||||||||||
| Written by Bruce Vining | ||||||||||
| Tuesday, 20 January 2009 19:00 | ||||||||||
|
Find out the rest of the story about the User Application Information APIs.
In the last column, we saw how to use the Update User Application Information API to set default values for a new user of the RPG_DEVELOPER_MY_APPLICATION application. Today, we will look at how to combine the Update API with the Retrieve User Application Information API in order to provide application awareness of past user preferences.
Specifically, we will see how to recall the previous file, library, member, and full-screen mode that was in use by the application user in the most recent use of the Start My Application (STRMYAPP) command. The command processing program (CPP) SMACPP used by STRMYAPP is provided here:
h dftactgrp(*no)
fMyAppFile if f32766 disk usropn f extfile(MyFile) f extmbr(ApplInfo.Member)
dSMACPP pr extpgm('SMACPP') d QualFileName 20 d MbrName 10
dSMACPP pi d QualFileName 20 d MbrName 10
dRtvUsrInf pr extproc( d 'QsyRetrieveUserApplicationInfo') d RcvVar 1 options(*varsize) d LenRcvVar 10i 0 const d RtnRcdFdBk likeds(QSYUAIFI) d Format 8 const d UsrPrf 10 const d ApplID 200 const options(*varsize) d LenApplID 10i 0 const d QUSEC likeds(QUSEC)
dUpdUsrInf pr extproc( d 'QsyUpdateUserApplicationInfo') d UsrPrf 10 const d ApplID 200 const options(*varsize) d LenApplID 10i 0 const d ApplInfo 1700 const options(*varsize) d LenApplInfo 10i 0 const d MinVRM 6 const d QUSEC likeds(QUSEC)
d/copy qsysinc/qrpglesrc,qsyusrin d/copy qsysinc/qrpglesrc,qusec
dApplInfo ds 100 qualified d File 10 d Library 10 d Member 10 d FullScreen 1
dRcvVar ds likeds(QSYI010004) d based(RcvVarPtr)
dRcvVarApplInfo ds likeds(ApplInfo) d based(RcvVarInfoPtr)
dMyFile s 21 dRcvVarPtr s * dRcvVarInfoPtr s * dApplID s 200 inz( d 'RPG_DEVELOPER_MY_APPLICATION') dMinVRM s 6 inz('V5R3M0') dWait s 1
iMyAppFile ns i 1 6 2SrcSeq i 7 12 0SrcDat i 1332766 SrcDta
/free
QUSBPRV = 0;
// Determine if data exists for this user RtvUsrInf(QSYI010004 :%size(QSYI010004) :QSYUAIFI :'RUAI0100' :'*CURRENT' :ApplID :%len(%trimr(ApplID)) :QUSEC);
Bruce Vining is president and co-founder of Bruce Vining Services, L.L.C., a firm providing contract programming and consulting services to the System i community (www.brucevining.com). He began his career in1979 as an IBM Systems Engineer in St. Louis, Missouri, and then transferred to Rochester, Minnesota, in 1985, where he continues to reside. From 1992 until leaving IBM in 2007, Bruce was a member of the System Design Control Group responsible for OS/400 and i5/OS areas such as System APIs, Globalization, and Software Serviceability. He is also the designer of Control Language for Files (CLF).
A frequent speaker and writer, Bruce can be reached at bvining@brucevining.com.
MC Press books written by Bruce Vining available now on the MC Press Bookstore.
| ||||||||||
| Read More >> | ||||||||||







You must be logged in to view or make comments on this article.