Table of Contents
Authorized( Function : Sub-function : Type)
Function = iSeries2web function (20A)
Sub-function = iSeries2web sub-function (20A) *Optional
Type = Type (20A) *Optional
Return type:
Boolean (N)
Description:
Use this function uses (function, subfunction and type) in an IF sentence (or similar) for testing authorization of a function or a unique keyword.
The entry in the security system is automatically created, the first time the function is used. Thereafter you can enter the administration system and change the default authorization.
Any text can be used in the 3 parameters. (see notes)
Example
If authorized(‘cust_pincode’ : ’ ‘ : ‘show’)
xmlA('custpin’ : pincode’)
else
XmlA('custpin’ : ‘not authorized’)
endif
Notes and Restrictions:
The system uses this function to test if a user is authorized to a specific function (also through the CallFunc function) so there is no need to test this inside your program...
BldButton
(BldButton has no parameter)
Return type:
Encoded Xml-string
Description:
BldButtons are used in conjunction with the build in variables (described in appendix B)
When setting the variable fs_mode or overriding with fs_edit, fs_update, fs_delete, fs_reload, fs_create –BldButton will create the corresponding buttons
Example
PutXmlRcd('dsoData':''
+BldButton
+XmlA('langcode' :fs_langcd)
+XmlA('disabled' :fs_disabled)
)
Calc(Arithmetic)
Arithmetic = A normal arithmetic statement
Return type:
Numeric value
Description:
Calc is a function to do arithmetic on xml variables in the “XML cloud” any numeric variable can be. The return value is the result of the calculation.
Example:
Result = Calc(100*totalA+(totalB – totalC))
The totalA, B and C are variables in the incoming “XML cloud”
Notes and Restrictions:
The variables are case sensitive
The max length of the statement is 5000 char and the number of variables and iterations are 40 (intended parentheses)
CallFunc(function:sub-function)
Function = name of a function in SSAPD001P
Sub-function = name of a subfunction in SSAPD001P (optional)
SOA = If this is set to ‘SOA’, it any changes to function/subfunction names, are reset to “before the callfuncXML was executed
Return type:
Error indicator
Description:
This is a function is used when building applications that utilize the full potential if iSeries2web. Instead of calling a program “hardcoded” you call a function. The name of the function and an optional sub-function will still be hardcoded, but you can now use the iSeries2web fileSSAPD001P to setup which program you call, depending on system, user, function and subfunction.
This way you get a very flexible deployment system for new applications and the ability to setup many functions that call the same program or same function that call different programs
Example:
If callfunc(‘order’:’edit’)
dspmsg(‘error_occoured’:error)
Endif
Notes and Restrictions:
Function and sub functions are case sensitive.
CallFuncXml(function:sub-function:xmlstring:extend:SOA)
Function = name of a function in SSAPD001P
Sub-function = name of a subfunction in SSAPD001P
xmlstring = the xmlString that should be a new cloud or extend current
extend = If this is set to ‘X’, it extends the current xml cloud
SOA = If this is set to ‘SOA’, it any changes to function/subfunction names, are reset to “before the callfuncXML was executed
Return type:
none
Description:
This function is similar to the callfunc, but allows you to extend the XML cloud with a temporary set of variables (encoded in XML) or create a new in-flight XML cloud, so the called function can’t see the original variables, only the ones you provide.
Example:
CallFuncXml(‘order’:’edit’:xmlA(‘newvar’:’abcdefg’):’SOA’)
Notes and Restrictions:
Function and sub functions are case sensitive.
Cmd(Command)
Command = String with command (500A)
Return type:
Completion code (‘Blank’ = ok, ‘error’ = ‘Failed’)
Description:
Use this function to execute a system command.
Example:
Cmd(‘clrpfm qtemp/testfile’)
Notes and Restrictions:
%%%%EditSectionPlaceHolder%%%% Parameters
P CreateSpace B Export
D PI N
D PSpaceName 10A Value
D PLibraryName 10A Value Options(*NoPass)
D PInitSize 10U 0 Value Options(*NoPass)
D PText 50 Value Options(*NoPass)
D PReplace 10 Value Options(*NoPass)
D PExtAttr 10 Value Options(*NoPass)
D PInitVal 1 Value Options(*NoPass)
D PAuthority 10 Value Options(*NoPass)
D PDomain 10 Value Options(*NoPass)
Used to create a userspace.
%%%%EditSectionPlaceHolder%%%% Example
CreateSpace('XMLCHG':'QTEMP':200000);
Will create a userspace in Qtemp, called XMLCHG, with a size of 200K Kbytes.
Crt_log_data(Origin : Type : Category : level : event : logdata)
Origin = Origin (10A)
Type = Type (3A)
Category = Category (10A)
Level = Severity level (2,0P)
Event = Event (5,0P)
Logdata = A text string describing the log entry
Return type:
Unique logID number (11,0P)
Description:
This is a function that automatically generates an entry in the logging administration system and returns the id of the log entry.
Then some kind of event happens in the system, normally something that should not occur, a divide by zero or customer number not valid etc. you would normally have a program crash or just catch the error and display a “sorry” message on the screen. This will not change, but now then you catch an error you can send this into a log file, to be retrieved later in the administration menu.
The variables are designed “as is” but should be sufficient to self the mist demanding system.
Here is an example:
Crt_log_data (
‘Customer’
:’err’
:’calculation’
:99
:0001
:’Devide by zero detected in’
+ syspgm
+ ‘variables= customer:’
+ %char(custno)
+ ‘total:’
+ %char(total)
+ ‘months:’
+ %char(months)
)
This will create a log entry, with the specifications and a text the would look like this
“ Divide by zero detected in CSMA062R variables=customer:12234 total:4500 months: 0”
Use the INFDS and the FS_variables to insert informational values into the string.
Notes and Restrictions:
Date, time, user, server and site information is automatically logged. No need to use the variables of the function for this information.
iSeries2web uses the function to create many entries in the logging system, most are if there are problems with authorization etc.
%%%%EditSectionPlaceHolder%%%% Create Document Link
p crtdoclnk B export
d crtdoclnk PI
D key 100A value varying
d idfield 30a value varying
D idno 13p 0 value
D putname 30a value varying
D fieldname 30a value varying
Used to create a link, that holds the key to a document. (text created on the iSeries). Normally used in conjunction with ajax calls.
%%%%EditSectionPlaceHolder%%%% Example
- Code is from a soon comming demo/Example application.
- Run the main part
/free
fs_disabled = disabled;
callfunc('acon001_soa':'display':'SOA');
crtDocLnk('acon001_doc':'con001id':0::); callfunc('atre001_soa':'list':'SOA');
// general link strip
callfunc('agen001_wrk_soa':'':'SOA');
return;
This program is used to generate a screen that uses the link to display and update a text (note) document on a customer.(And other customer information.
The HTLM is described in the
Ajax section.
%%%%EditSectionPlaceHolder%%%% Delete UserSpace
P DeleteSpace B Export
D PI N
D PSpaceName 10A Value
D PLibraryName 10A Value options(*nopass)
%%%%EditSectionPlaceHolder%%%% Example
DeleteSpace('Space_name')
Deletes the userspace named 'Space_name'.
DspMsg (error : class: field: variable1: variable2: variable3: variable4: variable5: variable6: variable7: variable8: variable9)
Error = language label (30A)
Class = CSS class (any class in a CSS linked document) (optional)
Field = Variable displayed in the browser (20A) (optional)
Variable1-9 replace string(s) (optional)
Return type:
Error code
Description:
DspMsg is used to send messages to the browser.
First parm is the a language label that later will be translated into real text.
Second is used for setting the class (color, font etc.) of the specific message
The third parm is a field name of a variable used in HTML (normally one that is related to an error type DspMsg) The variable in HTML will be set to the same class as the error
Variable1-9 are pieces of text that will be inserted into the translated text at the points where a % is defined. It looks like this
Language label ‘an_error’ is translated to ‘The name %1 is number :%2’
When used like this
(custname1=’Annabelle’ and number=12)
DspMsg(‘an_error’:error:name:custname1:%char(number))
This will be displayed on the screen:
“The name Annabelle is number 12”
FmtD(variable:value)
Variable = The name of a variable in SSAPD012P
Value = a numeric value to be formatted (8,0)
Return type:
Formatted date in a string
Description:
This function returns the date value in a formatted state.
Formatted as SSAPD000P indicates with the length of the definition of
SSAPD012P
Example:
Eval printdate = FmtD(‘crt_date:crt_date)
or
CallP PutXmlRcd('dsoData':
BldButton +
XmlA(FmtD(‘crt_date:crt_date))
) FmtT(variable:value)
Variable = The name of a variable in SSAPD012P
Value = a numeric value to be formatted (8,0)
Return type:
Formatted time in a string
Description:
This function returns the time value in a formatted state.
Formatted as SSAPD000P indicates with the length of the definition of
SSAPD012P
Example:
print_ime = FmtT(‘crt_time:crt_time)
or
PutXmlRcd('dsoData':
BldButton +
XmlA(FmtT(‘crt_time:crt_time)
)
)
GenIDno(key)
Key = name of Id number sequence
Return type:
Numeric value incremented by 1
Description:
This is a function that automatically generates a sequence of number identified by a “key”
Normally used for a unique identifying number for order, invoices or in most cases a ID number on a record.
Example:
imidno = genidno('csmaimp')
The variable imidno is a unique is in the file csmaimp. The “key” is the file name this way keys don’t get mixed up.
(see program CSMAIM62R)
Notes and Restrictions:
The “key” is case sensitive
GenIDtag(xml string)
Xml String = Encoded XML string (32.000A)
Return type:
Unique ID code
Description:
For security reasons links etc. are encoded as a unique ID number. This way you can use any protected information (e.g. social security number etc.) in your links on the browser.
Normally you would set a link with query information displayable on the link:
http://www.xxxxx.com/somepage.asp?name=”Albertha”+secretinfo=”reveal”
You see this on top of your screen or in the hyperlink inside the HTML source
With iSeries2web the function GenIDtag all this is encoded and therefore not displayable in the browser.
The information you want to embed into the code is written in normal XML functions and then set into the GenIDtag function.
/free
Putxmlrdc(list_of_links:
+XmlA('link':GenidTag(
+Xmla('name':'Albertha')
+Xmla('secretinfo’:’revael’)
)
)
/end-free
This way the 2 inner xmlA functions sends the encoded xml-string into the GenIDtag function, which created the code and sends this to the outer xmlA (the link)
When the user clicks on the link the values just encoded can be retrieved by normal RtvVar functions
All kinds of functions are allowed as the xml-string
Notes and Restrictions:
Only one ID code is allowed pr. Link.
GenLink(Name : Function : Subfunction : Class : Target : Label : XML : Label type)
Name = HTML variable (30A)
Function = iSeries2Web function from SSAPD001P (20A)
Subfunction = iSeries2Web Sub-function from SSAPD001P (20A)
Class = CSS (Stylesheet) Sets the style of the hyperlink (20A)
Target = HTML target frame ( _self, _Blank , “Name”) (20A)
Label = Text on the hyperlink (200A)
XML = The XML data information encoded in the hyperlink (32000A)
Label type = *optional. The label is default, translated through the
language system. Specifying this parameter, enables control
over this. “L” = Language control , all other will disable the language control system and the text in the hyperlink will be as specified in the Label variable. (1A)
Return type:
Encoded XML that creates a encoded hyperlink, with a unique ID
Description:
For security reasons links etc. are encoded as a unique ID number. This way you can use any protected information (e.g. social security number etc.) in your links on the browser.
Normally you would set a link with query information displayable on the link:
http://www.xxxxx.com/somepage.asp?name=”Albertha”+secretinfo=”reveal”
You see this on top of your screen or in the hyperlink inside the HTML source
With iSeries2web the function GenIDtag all this is encoded and therefore not displayable in the browser.
The information you want to embed into the code is written in normal XML functions and then set into the GenLink function.
This function uses the Genid function, to make it easier to create hyperlinks. I the HTML page specify the name of the link in
“name”, and it will be transformed into at hyperlink.
Putxmlrdc(list_of_links:
GenLink(
:‘LINK’
:‘customer’
:‘edit’
:‘buttonclass’
:‘_self’
:‘l_edit_customer’
:xmlN('cust_no’: custno)
+xmlN('cust_tlf’: custtlf)
)
)
This way the 2 inner xmlN functions sends the encoded xml-string into the GenLink function, which created the code and sends this to the outer Putxmlrcd function, together with the rest of the hyperlink definitions.
When the user clicks on the link the values just encoded can be retrieved by normal RtvVar functions
All kinds of functions are allowed as the xml-string
GenSysId(key)
Key = name of Id number sequence
Return type:
Numeric value incremented by 1
Description:
This is a function that automatically generates a sequence of number identified by a “key”
Normally used for a unique identifying number for order, invoices or in most cases a ID number on a record. This value is unique across all servers on the same iSeries machine
Example:
imidno = gensysid('csmaimp')
Notes and Restrictions:
The “key” is case sensitive
GenTxt (Language label : Language : variable1: variable2: variable3: variable4: variable5: variable6: variable7: variable8: variable9)
Language label = language label (30A)
Language = Language code (optional)
Variable1-9 replace string(s) (optional)
Return type:
Translated text string
Description:
GenTxt is used to generate tests strings for browsers, print etc that have to be compatible with many languages (or one)
First parm is a language label that later will be translated into real text.
Second is the language code the text should be returned as
Variable1-9 are pieces of text that will be inserted into the translated text at the points where a % is defined. It looks like this
Language label ‘cust_list001’ is translated to ‘Customer list from %1 to %2’
When used like this
(from=’Annabelle’ and to=Bertha)
print_header=gentxt(‘cust_list001:fs_langcd:from:to)
This will be displayed on the screen:
“Customer list from Anabelle to Bertha”
As the language code the iSeries2web supplied fs_langcd (see appendix B) is used. This will give a translation into the language the user selected at sign on
(You can change fs_langcd if you want, it will be restored at next roundtrip)
GetCoreVal(‘key’:value)
Key = name of Id for the value
Value = the value (if change / create is required) *Optional (1000A)
Return type:
Alphanumeric value
Description:
This is a function that automatically generates and retrieves a value unique for the Coresystem. E.g. the value is the same for all sites on the system.
If value is used the core value is created or changed.
Normally used for placing values for program flow control. E.g. a Yes/No value for controlling a test etc.
Example:
If GetCoreVal(‘is_system_active) = ‘Yes’
Notes and Restrictions:
The “key” is case sensitive
GetSiteVal(‘key’:value)
Key = name of Id for the value
Value = the value (if change / create is required) *Optional (1000A)
Return type:
Alphanumeric value
Description:
This is a function that automatically generates and retrieves a value unique for the site.
If value is used the site value is created or changed.
Normally used for placing values for program flow control. E.g. a Yes/No value for controlling a test etc.
Example:
If GetSiteVal(‘Test_cistomer_zip) = 'yes' //(could be any value)
Notes and Restrictions:
The “key” is case sensitive
%%%%EditSectionPlaceHolder%%%% GetSpace Pointer
P GetSpacePtr B Export
D GetSpacePtr PI *
D SpaceName 10A Const
D LibraryName 10A Const Options(*NoPass)
Used to retrive a pointer for a userspace.
%%%%EditSectionPlaceHolder%%%% Example
xml_ptr = GetSpacePtr('Space_Name')
Retrives the pointer for the userspace named 'Space_Name', in the current *libl.
GetUrl (URL string : Filename : Timeout)
URL string = The URL i.e. "http://www.yahoo.com" (32000A)
Filename = The filename and path where the URL return data is stored. (32000A)
Timeout = no. of. seconds GetUrl waits for a responce (*optional)
Return type:
Description:
GetURL gets data from any URL on the internet, Using the GET method. This is used go fetch information such as real data XML (currentcy rates) or .pfd files
NbFmt(value:variable)
Value = a numeric value to be formatted (30,8)
Variable = The name of a variable in SSAPD012P (optional)
Return type:
Formatted number in a string
Description:
This function returns the numeric value in a formatted state. If the second parameter is not used the value is formatted as described in the system file (SSAPD000P).
If the second variable is specified the attributes for this variable (from SSAPD012P) is used.
Example:
printvalue = NbFmt(amount:std_format)
PutXmlRcd('dsoData':
BldButton +
XmlA('value’:NbFmt(amount)
)
Now(indicator)
Indicator = ‘d’ returns the date in YYYYMMDD
‘t’ returns the time in HHMMSS
Return type:
Numeric value of the cirrent date or time (8,0 or 6,0)
Description:
This is a function that automatically returns the current system date or time.
Much like the “time” function in RPG. Only difference is that this can be used inside functions.
Example:
if now('d') > 20040901
or
Logdate = now('d')
Logtime = now('t')
Notes and Restrictions:
Using “now” inside a loop will return the current time (or date) and therefore a loop that runs for more than a second will not return the same time for each function call it will be increased as time passes. So if you want a creation of multiple records to have the same creation time, “Eval” the time variable outside the loop.
PostURL (URL string : Filename : Timeout)
URL string = The URL i.e. "http://www.yahoo.com" (32000A)
Filename = The filename and path where the URL return data is stored. (32000A)
Timeout = no. of. seconds GetUrl waits for a responce (*optional)
Return type:
Description:
PostURL gets data from any URL on the internet, Using the POST method. This is used go fetch information such as real data XML (currentcy rates) or .pfd files
PutXmlRcd (xml_document name: xml string)
Xml_document = Constant or alphanumeric field (30A)
Xml String = Encoded XML string (32.000A)
Return type:
Error indicator
Description:
PutXmlRcd writes the XML encoded string as an record in a xml-document with the name of parameter one. This is a primary function for building a xml string.
All kinds of functions are allowed as the xml-string, and this is also the normal use of this function
Example:
/free
PutXmlRcd(‘subfile001’:''
+XmlA(‘customer’:name1)
+XmlA(‘Street’:adress1)
+XmlN(‘Streetno:str_number)
)
/end-free
Notes and Restrictions:
The name of the xml document are restricted (see Rules)
RTVDS (‘Filename’ : Data record)
Filename = Constant or alphanumeric field (10A)
Data record = the corresponding data structure with data
Return type:
Datarecord
Description:
rtvDS returns a data record. The individual fields are retrieved from the file description of the filename in parameter 1. The decoding, from XML, of the individual fields is taken from the administration setup. The data inserted into the record description. Any field that is not represented in the XML, is given the value from the corresponding field value from the data record in parameter 2.
The first time the command is used, the administration setup is automatically created. If a field is located in SSAPD012P the field is automatically activated. If the field is located in SSAPD014P it is also activated. Date and time fields are normally created as nummerinc and require a change of the setup file. (found in the administrator menu)
Example:
Customer_rec = rtvDS(‘Customerfile’ : empty_customer_rec)
Uses the File description of the customerfile (Even though you program uses a logical file, use the name of the physical file here) Then the command places the data from the XML into the correct fields in the customer_record. Using the “field definitions” in the administrator menu.
See program CSMAIM62R for more detail.
Notes and Restrictions:
The variable name is converted to upper case.
Remember that the layout of the second variable, MUST match the filename in variable 1.
RtvvarA (variable name:sequence)
variable name = Constant or alphanumeric field (30A)
Sequence = numericvalue (11P)
Return type:
String value
Description:
RtvVarA retrieves an xml variable from the XML document data stream. And returns the value as a string.
Example:
Eval alfa = RtvVarA(‘test_filed’)
Sequence is used for having multiple fields with the same name. This is used for multi-line entry screens. This way the fields can be retrieved the same way.
Notes and Restrictions:
The variable name is case sensitive.
RtvvarCB (variable name:sqquence)
variable name = Constant or alphanumeric field (30A)
Sequence = Nummeric value (11P)
Return type:
String value of ‘0’ or ‘1’ (1A)
Description:
RtvVarCB retrieves an xml variable from the XML document data stream. And returns the value as a string.
Example:
Eval send = RtvVarCB(‘yes_or_no’)
Sequence is used for having multiple fields with the same name. This is used for multi-line entry screens. This way the fields can be retrieved the same way.
Notes and Restrictions:
The variable name is case sensitive.
RtvvarD (variable name)
variable name = Constant or alphanumeric field (30A)
Return type:
Numeric value of a date in yyyy / mm / dd (8,0)
Description:
RtvVarD retrieves an xml variable from the XML document data stream. And returns the value as numeric value. The input value is reformatted into YYYYMMDD from the format specified in the system setup SSAPD000P.
Example:
Eval date = RtvVarD(‘date’)
Notes and Restrictions:
The variable name is case sensitive. If an invalid date is entered the system send a message to xml document dsoMsg, but the function will still return the value for further testing or returning to the browser
If not specified in SSAPD012P it uses the *default date setup in SSAPD012P
RtvvarN (variable name:Sequence)
variable name = Constant or alphanumeric field (30A)
Sequence = Nummeric value (11P)
Return type:
Numeric value of a 30,10 (12345678901234567890,1234567890)
Description:
RtvVarN retrieves an xml variable from the XML document data stream. And returns the value as numeric value (30,10).
Example:
Eval money = RtvVarN(‘amount’)
Sequence is used for having multiple fields with the same name. This is used for multi-line entry screens. This way the fields can be retrieved the same way.
Notes and Restrictions:
The variable name is case sensitive. If an invalid numeric value is entered the return value is 0. If using decimal test the field will be returned as required e.g. a test of 2 decimals returns only the first 2 decimals of a filed 123.1234.
This is to prevent errors in your RPG program
RtvvarT (variable name)
variable name = Constant or alphanumeric field (30A)
Return type:
Numeric value hhmmss (6.0)
Description:
RtvVarT retrieves an xml variable from the XML document data stream. And returns the value as numeric value (6.0).
Example:
Eval lunch = RtvVarT(‘time’)
Notes and Restrictions:
The variable name is case sensitive.
If an invalid time is entered the system send a message to xml document dsoMsg, but the function will still return the value for further testing or returning to the browser
If not specified in SSAPD012P it uses the *default time setup in SSAPD012P
In iSeries2web v. 5.3 a feature to create tabs is implemented
(The examples here under is not in text, as the wiki will try to interpet the tab tags. same thing goes for the Sctipt tag in the javascript example)
It's easy to use and is made only in HTML.
Just use this simple notification:

Here is a real example of code (On tab 2 it uses the new Ajax function, just to show that scripting easily can be used inside the tabs) :

And the result:
%%%%EditSectionPlaceHolder%%%% Upload
In iSeries2web there is a build in upload function.
It uploads files to the webserver in a isolated location. Protected from unautorized download.
%%%%EditSectionPlaceHolder%%%% How it works
- The upload function uploads the file to the server in a temporary space together with up to 5 keys and a description to identify the file later.
- The file's mime definition (the type) is then testet against autorized mime definitions on the iseries host.
- If autorized, a unique key is generated, and keys to identify the file again are stord in a archive.
- Then the file is stored on the webserver with the unique name and a message is sendt to the upload window.
- If not autorized a message is sendt to the upload window and the temporary file is discarted.
When the file is uploaded it is saved with a unique key and name. The key is used to retrive the file again and the unique filename allows for uploading of files with the same name without conflicting.
Fig 1. Screendump of the upload dialog.
%%%%EditSectionPlaceHolder%%%% Keys
The dialog is hardcoded to upload to a master key. E.g. you set the main index for the uploaded file. ex. "Customer Images" or "Public Helpfiles" etc.
After this main "Key" you can set 5 additional keys, ex. CustomerId, InvoiceID and OrderID.
It is only the values that are stored, not the "names" of the keys.
You will know that on master key "Customer Images", you have chosen to set key1 as the CustomerID, and key2 as the InvoiceId. e.g. it's up to you to create a search program that finds the correct entry. This entry has the unique name of the file, that you need to retrive it again.
%%%%EditSectionPlaceHolder%%%% Implementaion
The simplest implementation is create a list of the uploaded files (with certain key combinations) together with a link to retrive the file again and a button (or link) to upload new files.
%%%%EditSectionPlaceHolder%%%% Displaying the uploaded files
The information for each uploaded file is located in a file named SSUPL004P, you can loop through, the file with servername + your main key, and optional keys.
ex. The putxmlrec for at list.
PutXmlRcd('lst_files':''
+ xmlA('ssfilename':ssfilename)
+ xmlA('ssfiledesc':ssfiledesc)
+ xmlD('ssfiledate':ssfiledate)
+ xmlA('showfile':GenIdTag(xmlN('id':idupl004)
+ XmlA('function':'dsp_arc')
)) As you can see the in the example it uses some informtion from the SSUPL004P file to display the filename, the description (entered by the user at upload time) and the date for the upload. There are more fields available, check the file description. The link is quite simple to use, just generate a tag with the unique id, and add the function "dsp_arc" to the tag, then iseries2web will take care of the rest.
iSeries2web also includes a series of standard icons you can use to make the list look nicer. To use the icons there is a file called SSUPL002P that holds the icons and a reference to the MIME type of the uploaded files. so the simplest way to get it is to chain with the mimetype (stored with the key in SSAPD004P) and use the path stored in SSAPD002P.
If ssIconName = *Blanks Or ssFileCont = *Blanks;
Chain (ssMime) ssupl002l1;
EndIf;
and add
+ XmlA('img':'images/upload/'+%trim(ssIconName)) to the putxmlrec.
%%%%EditSectionPlaceHolder%%%% Uploading new files
To upload files you must provide iseries2web with a masterkey and the optional 5 extra keys. to do this you must create a link that calls a CMS code with your keys, this way you can control that the upload will be saved in the correct context. E.g. you create a "hardcoded" set of keys and send them to the upload control, this control will then upload the file together with the keys and the description.
You can create more than one "upload" link to upload the same file with different keys.
Here is an example on how to create a CMS code (that lasts for 60 minutes and have the keys for the upload).
The key is normally retrieved from the screen. Imagine that on a customer screen, you would have a customer id. and an icon or a link to display the list of files. This link would have the needed keys.
Begsr Crt_Upload;
ssmainkey = 'CustomerFiles';
sskey1 = rtvVarA('cus001id');
sskey2 = ' ';
sskey3 = ' ';
sskey4 = ' ';
sskey5 = ' ';
cmscode = RandomWord;
setll (fs_svrnam:cmscode) ssapd015p;
dow %equal(ssapd015p);
cmscode = RandomWord;
setll (fs_svrnam:cmscode) ssapd015p;
enddo;
cmsvrnam = fs_svrnam;
cmperm = 'E';
cmdate = now('d');
cmtime = now('t');
cmexpire = %timestamp() + %minutes(60);
cmsparm = ' '
+ xmlA('mainkey':ssmainkey)
+ xmlA('key1':sskey1)
+ xmlA('key2':sskey2)
+ xmlA('key3':sskey3)
+ xmlA('key4':sskey4)
+ xmlA('key5':sskey5);
write rssapd015;
EndSr;
After this just add this to you main flow.
Exsr Crt_Upload;
CustomerFiles = cmscode;
And create the xml for the link.
Begsr Crt_Header;
PutXmlRcd('dsoData':' '
+ xmlA('arccustomer':CustomerFiles)
);
EndSr;
in your HTML you add the necessary code to display the list and add the link to upload.
{Code html}
{/Code}
XmlA (variable name : value:Sequence)
variable name = Constant or alphanumeric field (30A)
value = Constant or alphanumeric field (30A)
Sequence = Nummeric value (11P)
Return type:
Encoded XML string
Description:
XmlA returns a string variable encoded in XML. This is a primary function for building a xml string.
This is normally used in conjunction with PutXmlRec function
Example:
Eval string = xmlA(‘name’:sir_name)
Functions in the statement are allowed, and often used.
Eval string = xmlA(‘full_name’:%trim(sir_name) + ‘ ‘ + %trim(last_name) )
Sequence is used for having multiple fields with the same name. This is used for multi-line entry screens. This way the fields can be retrieved the same way.
Notes and Restrictions:
The variable name is case sensitive
XmlAdd (variable name : value)
variable name = Constant or alphanumeric field (30A)
value = Constant or alphanumeric field (30A)
Return type:
Description:
XmlAdd add's a value to the incomming XML cloud. This is normally used to add a generated customer nummber to the Incomming cloud, before continuing to other SOA modules (via a Business process)
Example:
XmlAdd(‘cust_no’:newcustno)
Notes and Restrictions:
If the variable name, already exists the variable is changed instead
XmlAF (variable name : value : length : disabled)
variable name = Constant or alphanumeric field (30A)
value = Constant or alphanumeric field (30A)
value = Length of display field (2.0) (optional)
*on/*off = Disable field (optional)
Return type:
Encoded XML string
Description:
XmlAF returns a HTML encoded display field in XML. This is a primary function for building fields to the browser.
This is normally used in conjunction with PutXmlRec function
Example:
Eval string = xmlAF(‘name’:sir_name)
Creates a field on the browser with the size of the value of the field + 3 blanks
Eval string = xmlAF(‘name’:sir_name:20)
Creates a field on the browser with the size 20
Eval string = xmlAF(‘name’:sir_name:0:*off)
Creates a field on the browser with the size of the field definition in file SSAPD012P, and disables it.
Functions in the statement are allowed, and often used.
Eval string = xmlAF(‘full_name’:%trim(sir_name) + ‘ ‘ + %trim(last_name) )
Notes and Restrictions:
The variable name is case sensitive.
XmlCB (variable name : value:inhibited:sequence)
variable name = Constant or alphanumeric field (30A)
value = Alphanumeric field (1A) or *on / *off
inhibited = Alphanumeric field (1A) or *on / *off
sequence = Numeric (5,0)
Return type:
Encoded XML string
Description:
XmlCB returns a string variable encoded in XML. This is a primary function for building an xml string.
This is normally used in conjunction with PutXmlRec function
Example:
Eval string = xmlCB(‘allowed’:xxallowed)
Default always ON
Eval string = xmlCB(‘allowed’:*on)
Notes and Restrictions:
The variable name is case sensitive.
XmlChg (variable name : value)
variable name = Constant or alphanumeric field (30A)
value = Constant or alphanumeric field (30A)
Return type:
Description:
XmlCHG changes a value in the incomming XML cloud. This is normally used to change a value, before continuing to other SOA modules (via a Business process)
Example:
XmlChg(‘cust_no’:othercustno)
Notes and Restrictions:
none
XmlD (variable name : value)
variable name = Constant or alphanumeric field (30A)
value = numeric field (8,0) YYYYMMDD
Return type:
Encoded XML string
Description:
XmlD returns a string variable encoded in XML. This is a primary function for building an xml string.
This is normally used in conjunction with PutXmlRec function
Example:
Eval string = xmlD(‘create’:date)
Notes and Restrictions:
The variable name is case sensitive.
Dates are automatically formatted by the system from YYYYMMDD into the format specified in the system file SSAPD000P
XmlDF (variable name : value : length : disabled)
variable name = Constant or alphanumeric field (30A)
value = numeric field (8,0) YYYYMMDD
value = Length of display field (2.0) (optional)
*on/*off = Disable field (optional)
Return type:
Encoded XML string
Description:
XmlDF returns a HTML encoded display field in XML. This is a primary function for building fields to the browser.
This is normally used in conjunction with PutXmlRec function
Example:
Eval string = xmlDF(‘date’:the_date)
Creates a field on the browser with the size of the value of the field
Eval string = xmlDF(‘date’:the_date:10)
Creates a field on the browser with the size 10
Eval string = xmlDF(‘date’:the_date:0:*off)
Creates a field on the browser with the size of the field and disables it.
Functions in the statement are allowed, and often used.
Eval string = xmlDF(‘date’:now(‘d’) )
Notes and Restrictions:
The variable name is case sensitive.
XmlDS (‘Filename’ : Data record : sequence : altname)
Filename = Constant or alphanumeric field (10A)
Data record = the corresponding data structure with data
Sequence = sequence number for multiple occurrences (optional)
Altname = An alternate name for the definition (optional)
Return type:
XML encoded string
Description:
XmlDS returns a XML encoded string. The individual fields is retrieved from the file description of the filename in parameter 1. The encoding of the individual fields is taken from the administration setup. The data inserted into the XML string is retrieved from the data record, sent as parameter 2.
The first time the command is used, the administration setup is automatically created. If a field is located in SSAPD012P the field is automatically activated. If the field is located in SSAPD014P it is also activated and created as a list box or radio button.
This is normally used in conjunction with PutXmlRec function
Sequence is used for having multiple fields with the same name. This is used for multi-line entry screens. This way the fields can be retrieved the same way.
Altname – normally the definitions are stored under function/subfunction. But in most cases the definitions are the same for e.g. subfunction, delete/create/edit/display, so instead of creating and maintaining 4-5 the “same” definitions, “alt name” can be used. So all the xmlDS uses the same altname and therefore the same definitions. (open and closed fields can still be achieved using fs_disabled functionality. E.g. the definitions for display and update are the same, but display has fs_disabled = disabled.
Example:
String = xmlDS(‘Customerfile’ : customer_rec : 0 : ‘update’)
Uses the File description of the customerfile (Even though you program uses a logical file, use the name of the physical file here) Then the commend places the data from the customer_record into the correct fields, using the setup in “field definitions” in the administrator menu. As we use ‘update’ as the altname, a sequence must be provided, but we have no use for one, so it’s 0, which equals “no sequence”.
See program CSMAIM62R for more detail on use and the Administrator section for definition explanation.
Notes and Restrictions:
Remember that the layout of the second variable, MUST match the filename in variable 1.
The variable name is converted to upper case.
XmlH (variable name : value : sequence)
variable name = Constant or alphanumeric field (30A)
value = Constant or alphanumeric field
sequence = Numeric (5.0)
Return type:
Encoded XML string
Description:
XmlH returns a string variable encoded in XML. This is a primary function for building an xml string.
This is normally used in conjunction with PutXmlRec function
Example:
Eval string = xmlH(‘keyfield’:id_code)
Notes and Restrictions:
The variable name is case sensitive.
Hidden fields are retrieved using RtvVarA, RtvVarN, RtvvarD etc.
Xmli (variable name : filename : path : border : width : height)
variable name = Constant or alphanumeric field (30A)
filename = name of the image (100A)
path = the path to the image, relative to the site (100A)
border = Size of the border (5,0P) *optional
width = width of the image (5,0P) (will scale the image) *optional
height = height of the image (5,0P) (will scale the image) *optional
Return type:
Encoded XML string
Description:
Xmli will place the image described in the function on the screen where the varnem I placed
This is normally used in conjunction with PutXmlRec function
Example:
Eval string = xmli(‘picture’ : ‘dog.jpg’ : ‘/images’)
Notes and Restrictions:
The variable name is case sensitive.
All variables can be constants or variables.
Xmli, can’t be retrieved again.
XmlL (variable name : value : alternative list))
variable name = Constant or alphanumeric field (30A)
value = Constant or alphanumeric field
alternative list = Constant or alphanumeric field (optional)
Return type:
Encoded XML string
Description:
XmlL Creates a listbox (or drop-down box) with values for the user to select. It uses the file SSAPD014P to generate a list of options for the list or to find a function that does the same.
SSAPD014P have two uses, normally it’s used for static lists like item notations M=meter, CM=Centimeters etc. because these does not change very often. The second use of SSAPD014P is to execute a function that generates the list, often using complicated logic e.g. credit limits that a specific customer can chose from.
This is normally used in conjunction with PutXmlRec function
The first two parameters are the variable that goes into the XML. The second are the default value (the one that the list starts with) e.g. if the list is 1,2,3,4,5 and the second parameter is 3 the list will start at 3.
The third parameter is used to redirect the variable name to an alternative list (another variable) in SSAPD014P. (see school 10 / 11)
The use is for etc. a list of item notations where SSAPD014P have a list defined as “item_notation” but the program(s) uses a variable in XML and HTML called “item_desc_2”. So instead of copying all the definitions from “Item_notation” to “item_desc_2” for the list to work, you simply set up the XMLL like this:
xmlL(‘item_desc_2’:value:’item_notaion’)
This will force the list of item_desc_2 to be generated like item_notation, thereby saving redundant data and maintenance in SSAPD014P
Example:
Eval string = xmlL(‘list_of_values’:dft_value)
And/or
Eval string = xmlL(‘list_of_values’:dft_value:’common_list’)
Notes and Restrictions:
The variable name is case sensitive.
List box fields are retrieved using XmlA, XmlN etc.
XmlLink (variable name : indata :label : function : subfunction : target )
variable name = Constant or alphanumeric field (30A)
inddata = alfa field (640000A)
label = alfa field (30A) *optional
function = alfa field (30A) *optional
subfunction = alfa field (30A) *optional
target = alfa field (30A) *optional
Return type:
Encoded XML string
Description:
XmlLink returns a link to be used in html pages. It works like
genlink but, instead of hardcodeing the values for the link, its controlled by the admin menu. This means that after using this once, it automatically creates a link i entry in the admin menu (menu item links) Here you can configure the link for what function, css and many more the link should use.
The entry is created under the function/subfunction it was executed under, with the name specified in variable 1.
This is normally used in conjunction with PutXmlRec function
Example:
xmllink('edit': xmlN('cus001id':cus001id))or (the same but with more values)
xmllink('edit':''
+ xmlN('cus001id':cus001id)
+ xmlA('name':wkname)
)
Notes and Restrictions:
The variable name is case sensitive
XmlN (variable name : value)
variable name = Constant or alphanumeric field (30A)
value = numeric field (max. 30.8)
Return type:
Encoded XML string
Description:
Xmln returns a string variable encoded in XML. This is a primary function for building a xml string.
This is normally used in conjunction with PutXmlRec function
Example:
Eval string = xmln(‘amount’:cust_balance)
Functions in the statement are allowed, and often used.
Eval string = xmln(‘amount’:cust_balance+(100/number))
Notes and Restrictions:
The variable name is case sensitive.
Nummeric values are retrieved using XmlN (or XmlA)
XmlNF (variable name : value : length : disabled)
variable name = Constant or numeric field (30A)
value = Constant or numeric field (30A)
value = Length of display field (2.0) (optional)
*on/*off = Disable field (optional)
Return type:
Encoded XML string
Description:
XmlNF returns a HTML encoded display field in XML. This is a primary function for building fields to the browser.
This is normally used in conjunction with PutXmlRec function
Example:
Creates a field on the browser with the size of the formatted value of the field + 3 blanks
Eval string = xmlNF(‘amount’:cust_balance)
Creates a field on the browser with the size 20
Eval string = xmlNF(‘amount’:cust_balance :20)
Creates a field on the browser with the size of the field definition in file SSAPD012P, and disables it.
Eval string = xmlNF(‘amount’:cust_balance :0:*off)
Functions in the statement are allowed, and often used.
Eval string = xmlNF(‘amount’:cust_balance + number)
Notes and Restrictions:
The variable name is case sensitive.
XmlR (variable name : value : alternative group))
variable name = Constant or alphanumeric field (30A)
value = Constant or alphanumeric field
alternative group= Constant or alphanumeric field (optional)
Return type:
Encoded XML string
Description:
XmlR creates a group of radio buttons with values for the user to select. It uses the file SSAPD014P to generate a group of options for the list or to find a function that does the same.
SSAPD014P have two uses, normally it’s used for static group like item notations M=meter, CM=Centimeters etc. because these does not change very often. The second use of SSAPD014P is to execute a function that generates the group, often using complicated logic e.g. credit limits that a specific customer can chose from.
This is normally used in conjunction with PutXmlRec function
The first two parameters are the variable that goes into the XML. The second are the default value (the one that the list starts with) e.g. if the list is 1,2,3,4,5 and the second parameter is 3 the list will start at 3.
The third parameter is used to redirect the variable name to an alternative group (another variable) in SSAPD014P. (see school 10 / 11)
The use is for etc. a group of item notations where SSAPD014P have a group defined as “item_notation” but the program(s) uses a variable in XML and HTML called “item_desc_2”. So instead of copying all the definitions from “Item_notation” to “item_desc_2” for the list to work, you simply set up the XMLR like this:
xmlL(‘item_desc_2’:value:’item_notaion’)
This will force the group of item_desc_2 to be generated like item_notation, thereby saving redundant data and maintenance in SSAPD014P
Example:
Eval string = xmlR(‘list_of_values’:dft_value)
And/or
Eval string = xmlR(‘list_of_values’:dft_value:’alternative_ group’)
Notes and Restrictions:
The variable name is case sensitive.
Radio Buttons are retrieved using XmlA, XmlN etc.
XmlT (variable name : value)
variable name = Constant or alphanumeric field (30A)
value = numeric field (6,0) HHMMSS
Return type:
Encoded XML string
Description:
XmlT returns a string variable encoded in XML. This is a primary function for building an xml string.
This is normally used in conjunction with PutXmlRec function
Example:
Eval string = xmlT(‘clock’:time)
Notes and Restrictions:
The variable name is case sensitive.
XmlTF (variable name : value : length : disabled)
variable name = Constant or alphanumeric field (30A)
value = numeric field (6,0) HHMMSS
value = Length of display field (2.0) (optional)
*on/*off = Disable field (optional)
Return type:
Encoded XML string
Description:
XmlTF returns a HTML encoded display field in XML. This is a primary function for building fields to the browser.
This is normally used in conjunction with PutXmlRec function
Example:
Creates a field on the browser with the size of the value of the field
Eval string = xmlTF(‘time’:the_time)
Creates a field on the browser with the size 10
Eval string = xmlTF(‘date’:the_time:10)
Creates a field on the browser with the size of the field and disables it.
Eval string = xmlTF(‘date’:the_time:0:*off)
Functions in the statement are allowed, and often used.
Eval string = xmlTF(‘date’:now(‘t’) )
Notes and Restrictions:
The variable name is case sensitive.