2 - data generation logical transactions and actions
DESCRIPTION
2 - Data Generation Logical Transactions and ActionsTRANSCRIPT
TriMin Focus GroupMarch 4th, 2010
Enterprise Integrator
Tips and Techniques!Data Generation Programs, Logical Transactions, and Program Actions
By Kevin [email protected]
TriMin Focus GroupMarch 4th, 2010
Enterprise Integrator
Tips and Techniques!Data Generation Programs, Logical Transactions, and Program Actions
By Kevin [email protected]
Objectives• Go over some “Tips and Techniques” around
Enterprise Integrator (E/I) in a variety of areas.– Combination of Power Point and “Live” Demo’s
• Review some nice utilities created to demonstrate techniques but also provide some free “take-away” software!
• Please ask questions and feel free to make comments! This should be interactive please!
• These tips are in the area of Data Generation, Logical Transactions, and Custom Actions.
DATA GENERATION PROGRAM
Data Generation Program – The Challenge
• I need to “create” a file first before displaying data
• Program can be an “RPG” program, CL, or Query as some examples
• Common to leverage existing “legacy” solutions to display “complex” information within Power Link
• For developers, almost like using a “sub-file” technique.
Data Generation Program - Applications
• Typical Applications:– Custom time-phased inventory availability
(MRP type item availability)– Inventory summarization or valuation routines– Dashboard/KPI Solutions (again where you
need to summarize data before display)– Any solution where you need to retrieve data
“real time” from many areas (files), and present in summarized or combined format
Data Generation Program – Step 1• Obviously, must create file first and bring it
into E/I. This is your “work file”
• Create “1 to Many” relationship from your business object to this “work file”
Data Generation Program – Step 2• From Actions, find List and change this to
add your data generation program
Data Generation Program - Considerations
• Need to think where you want to “launch” this from. Item Revision? Item Warehouse? Both?
• Need to think about how “work file” is keyed. User? Item? This file is reused by other people!
• Do you need to clear file periodically? • Make sure file is Reuse deleted “*YES”
• May need to “delete” records in program first before re-displaying.
Data Generation Program – Solution Example!
• My Challenge:– Want a Power Link utility to display file/library
usage– Need to be able to quickly see what files are taking
up my disk space and other useful information!– Using a system command (DSPOBJD) to create
the file– All the code/business objects will be made
available to you as a “freebie” and to have as an example and to use everyday!
– Lets see it work!
Data Generation Program – How it worked…
LIBANZPF – Entry for each library
analyzed by tool
DSPOBJD – Contents of
library selected
Data Generation Program – XA Solution Example (MRP Item Availability)
LOGICAL TRANSACTIONS
Logical Transactions – The Challenge• I need to imbed a “process” step into my
application.• I need to run a program “on demand” over a
selected record (or records)• I need to perform a set of calculations or activity
against more than one file (object) and update many files
• I need a way to isolate and/or secure a function or feature
• Typically used to perform activity on one “selected” record but not always
Logical Transactions – Applications
• Typical Applications:– Approve a record from toolbar button– Run complex set of calculations in a Quote
Application to price a quote (reading from many files and possibly updating several files)
– In a work flow process, change status to something else and then populate information in another file.
– Give someone a quick/convenient way to perform any action on a file (vs. hitting change pencil)
Logical Transaction – Step 1• Go into object and Transactions Tab.
• Decide what type of transaction you are doing.– Change, Delete, Create, Mass-Change,..
Logical Transaction – Types• If you want a logical transaction to simply “change”
a flag or field or group of fields within a file, select the change and hit “create”.
Logical Transaction – Types• This type of transaction (change, delete, etc.) will let you
do things like display a confirmation message (preview) before the update and assign security and usually requires no “coding”
Logical Transaction – Types• If you want a “headless” (stand-alone) logical transaction, hit the Create button before selecting Change, Delete, etc…
• This type creates a “logical object” complete with user exits and all the other features of an “independent” object and requires coding to complete and is usually used to update more than just the file that the logical is built over (more complex)
Logical Transaction – Step 2• In the case of a “headless” type, add your
attributes, and any relationships to code files • Generate User Exits so that your logic can be
inserted.
Logical Transaction – Solution Example!• My Challenge:
– I want a utility to display “active jobs” on the system within Power Link– I don’t want to have to go to a “green screen” and type in WRKACTJOB– To accomplish this we will write a program to output to a file, the contents of
WRKACTJOB– In this following example we are using the “headless” type of transaction to facilitate
this.– This one is another “Freebie” that you can take with you!– Lets take a look! (we will also take a quick look at the “change logical” technique)
Logical Transaction – How it worked…• In our example we wanted to prompt for two values.
These are fed to the program that outputs WRKACTJOB• These are setup as logical attributes, and passed to the
program that is called. • In our case ,we wanted to prompt for “reset” of statistics
and give the user the option to call this for just a specific subsystem.
Logical Transaction – How it worked…• In the Process Buffer program “*O0R” put in the call to
your program as shown (typically section 8.000)• It is here we put our call to the program to refresh
information and pass it the parameters.
Logical Transaction – How it worked…• The program we called ran a simple routine to do a
WRKACTJOB and copy it to a physical file.
Logical Transactions – Other Benefits
• You get a maintenance history entry that the transaction occurred
• Activity also shows up in “Transaction Status”• You can secure this process independently.• You get an edit buffer to validate if you can
perform the operation/action• You get a default buffer (to set values)• You can setup relationships to code files, other
files, and setup prompted logical fields of any type (date, flags, buttons, etc..)
Logical Transactions – Considerations
• If deployed from a list card, you have to “post” transaction before the activity occurs.
• For this reason, sometimes an “Action” button is preferred method.
• The Action Program action will be reviewed next.
Program Action
Program Action – The Challenge• I need a “quick/simple” way to run a
program.
• In many cases you don’t even need to prompt for a value
• I don’t want to “post” each transaction. I just wasn’t it to do it “now!” from a list card or top toolbar of a list of records.
• I want to do this on a “single” record or be able to run this on a group of records.
Program Action - Applications
• Typical Applications:– Give me an action button to update planner, buyer,
and vendor number from within Item Revision. – I need to be able to run a form (type) report quickly
from a list view of information (ECR/ECN)– I need to run a simple program that sends out an alert
or e-mail on-demand. – I have a configuration type application. I need to run a
program based on my selection, update a file, and stay on the immediate screen to review results of selection.
Program Action – Step 1• Go into the object and Actions Tab
• Hit “Create”
• Note you can create a Host, Local, create a “Mass Action”, or link to a URL
Program Action – Step 2• In this example, we are creating a call to a Host (iSeries)
Program• The program must exist before you do this. • You can pass the program variables (from selected record)
and also special values (like current user)
Program Action– Solution Example!• My Challenge:
– I have repurposed some user fields over MO Components to reflect if part has been picked, the quantity, and user initials (prior to issue)
– I don’t want to “post” each transaction. I just wasn’t it to do it “now!” from a list card.
– I don’t have any editing. I only need to prompt for quantity to pick.– I have a little user program ready to go. It simply receives in the
MO/Component # and updates the user fields – Lets take a look!
Program Action – How it worked…• When we created the program action, we simply created
4 parameters to make it work. (Only 1 is prompted for) – The Order (selected)– The Sequence Number (of the component selected)– We default quantity pick to the standard quantity required.
Essentially any variable can be passed to program from file– The current user ID.
Program Action – How it worked…• Program was simply called. • There was no need to deal with a transaction broker
(middle-layer) of code• Note you can use this to call PC programs or programs
on a server as you will see shortly.• You can also use this to call a URL or a file for example
stored on a network drive.
Program Action – Mass Action• This can be used to do the “action” on multiple records at one
time.• Can pass parameters or simply run.• In this case a simple standard program is needed (using a
SQLRPGLE)• We will include a sample of this code in your “take-aways” (called
MASSACTION). Using this sample you can easily create your own “mass actions”.
• With mass action user can select multiple records on list card or list view
Program Action – Mass Action
• In this case the update is done within the SQLRPGLE by passing the subset
• The example below shows our Pick solution using this method of using the selected records in subset.
Program Action – Mass Action
• Subroutine PSVRMS0R called within the “MASSACTION” program is what retrieves the SQL statement using the passed token and is really the key to how this works.
Program Action – Mass Action
• Your custom logic will exist in PRCSQL as it processes the SQL statement to update your specific file/application
• The code sample is relatively generic and easy to understand.
Program Action – Mass Action
• Final Note. You can also with Action/Mass action send confirmation and error messages back to the client.
• While it’s not as structured as using a (Headless) Logical transaction and the edit buffer, you can call a program to accomplish this.
• Included with your take-away is a document called “Passing messages back from a user host program”
• This technique uses an XA supplied program called PSXEMP3R
Program Action – Mass Action
Program Action – Mass Action
Program Action – Local Programs• This can also be used to call a PC/Network
Program• Below is a URL example to Call Excel!• Common usage of this is to call engineering
drawing viewers passing in the item/drawing #
Program Action – URL’s• This can also be used to call a URL and pass parameters• Below is the URL action code to call up UPS with a UPS
tracking number!• When dealing with URL’s and parameter substitutions,
you need to make sure you put double “&&” around URL substitutions and single “&” around your parameters from the file
Any Questions On What We Just Covered?