2 - data generation logical transactions and actions

43
TriMin Focus Group March 4 th , 2010 Enterprise Integrator Tips and Techniques! Data Generation Programs, Logical Transactions, and Program Actions By Kevin Gerard [email protected]

Upload: randt1972

Post on 31-Dec-2015

38 views

Category:

Documents


1 download

DESCRIPTION

2 - Data Generation Logical Transactions and Actions

TRANSCRIPT

Page 1: 2 - Data Generation Logical Transactions and Actions

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]

Page 2: 2 - Data Generation Logical Transactions and Actions

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.

Page 3: 2 - Data Generation Logical Transactions and Actions

DATA GENERATION PROGRAM

Page 4: 2 - Data Generation Logical Transactions and Actions

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.

Page 5: 2 - Data Generation Logical Transactions and Actions

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

Page 6: 2 - Data Generation Logical Transactions and Actions

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”

Page 7: 2 - Data Generation Logical Transactions and Actions

Data Generation Program – Step 2• From Actions, find List and change this to

add your data generation program

Page 8: 2 - Data Generation Logical Transactions and Actions

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.

Page 9: 2 - Data Generation Logical Transactions and Actions

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!

Page 10: 2 - Data Generation Logical Transactions and Actions

Data Generation Program – How it worked…

LIBANZPF – Entry for each library

analyzed by tool

DSPOBJD – Contents of

library selected

Page 11: 2 - Data Generation Logical Transactions and Actions

Data Generation Program – XA Solution Example (MRP Item Availability)

Page 12: 2 - Data Generation Logical Transactions and Actions

LOGICAL TRANSACTIONS

Page 13: 2 - Data Generation Logical Transactions and Actions

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

Page 14: 2 - Data Generation Logical Transactions and Actions

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)

Page 15: 2 - Data Generation Logical Transactions and Actions

Logical Transaction – Step 1• Go into object and Transactions Tab.

• Decide what type of transaction you are doing.– Change, Delete, Create, Mass-Change,..

Page 16: 2 - Data Generation Logical Transactions and Actions

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”.

Page 17: 2 - Data Generation Logical Transactions and Actions

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”

Page 18: 2 - Data Generation Logical Transactions and Actions

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)

Page 19: 2 - Data Generation Logical Transactions and Actions

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.

Page 20: 2 - Data Generation Logical Transactions and Actions

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)

Page 21: 2 - Data Generation Logical Transactions and Actions

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.

Page 22: 2 - Data Generation Logical Transactions and Actions

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.

Page 23: 2 - Data Generation Logical Transactions and Actions

Logical Transaction – How it worked…• The program we called ran a simple routine to do a

WRKACTJOB and copy it to a physical file.

Page 24: 2 - Data Generation Logical Transactions and Actions

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..)

Page 25: 2 - Data Generation Logical Transactions and Actions

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.

Page 26: 2 - Data Generation Logical Transactions and Actions

Program Action

Page 27: 2 - Data Generation Logical Transactions and Actions

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.

Page 28: 2 - Data Generation Logical Transactions and Actions

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.

Page 29: 2 - Data Generation Logical Transactions and Actions

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

Page 30: 2 - Data Generation Logical Transactions and Actions

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)

Page 31: 2 - Data Generation Logical Transactions and Actions

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!

Page 32: 2 - Data Generation Logical Transactions and Actions

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.

Page 33: 2 - Data Generation Logical Transactions and Actions

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.

Page 34: 2 - Data Generation Logical Transactions and Actions

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”.

Page 35: 2 - Data Generation Logical Transactions and 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

Page 36: 2 - Data Generation Logical Transactions and Actions

• The example below shows our Pick solution using this method of using the selected records in subset.

Program Action – Mass Action

Page 37: 2 - Data Generation Logical Transactions and Actions

• 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

Page 38: 2 - Data Generation Logical Transactions and Actions

• 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

Page 39: 2 - Data Generation Logical Transactions and Actions

• 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

Page 40: 2 - Data Generation Logical Transactions and Actions

Program Action – Mass Action

Page 41: 2 - Data Generation Logical Transactions and Actions

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 #

Page 42: 2 - Data Generation Logical Transactions and Actions

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

Page 43: 2 - Data Generation Logical Transactions and Actions

Any Questions On What We Just Covered?