0% found this document useful (0 votes)
59 views

Qdoc - Tips - Workshop Template Programming

The document describes a workshop exercise on template programming. It provides instructions on creating a template for order entry fields, defining the fields using a template routine, compiling the routine and creating the necessary files and setup using various Globus applications. It then discusses adding checks to populate the order date with current date and validate the customer number by checking an existing customer file.

Uploaded by

Sushma V Kumar
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
59 views

Qdoc - Tips - Workshop Template Programming

The document describes a workshop exercise on template programming. It provides instructions on creating a template for order entry fields, defining the fields using a template routine, compiling the routine and creating the necessary files and setup using various Globus applications. It then discusses adding checks to populate the order date with current date and validate the customer number by checking an existing customer file.

Uploaded by

Sushma V Kumar
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 7

WORKSHOP ON TEMPLATE PROGRAMMING

EXERCISE I

1) Create
Create a templa
template
te for
for the
the follo
followin
wing
g

Requirements -
Field No. Field Name Type Details
0 ID Order No. 16,A Standard Globus format
1 Customer No 10 , C U S Mandatory
2 Order Date 11 , D Mandatory
3 XX<Item 35 , A Mandatory
4 XX-Quantity 16, AMT Mandatory
5 XX>confirmed Only Yes or No
6 Local 10,A No input

 Solution :
Defi
Define
ne the
the fiel
field
d name
namess alon
along
g with
with the
the char
charac
acte
teri
rist
stic
icss usin
using
g the
the temp
templa
late
te rout
routin
inee
XX.FIELD.DEFINITIONS

>ED BP XX.FIELD.DEFINITIONS

Then save the routine in BP by replacing XX with ORDZZ where ZZ is your initials.

----: Save BP ORDZZ.FIELD.DEFINITIONS.


ORDZZ.FIELD.DEFINITIONS.
Quit.
----:Q

 Now open the new routine copied


cop ied and make the necessary
necess ary changes for the above
abo ve template.

>ED BP ORDZZ.FIELD.DEFINITIONS
ORDZZ.FIELD.DEFINITIONS

Here define parameters for the field as under.

DEFINE.FIELDS:
0020:
0021: ID.F = "ORDER.NO" ; ID.N = "16" ; ID.T = "A" ; ID.T<4> =
"#####/#####/#####"
0022: *
0023: Z=0
0024: *
0025: Z+=1 ; F(Z) = "CUSTOMER.NO" ; N(Z) = "10.1" ; T(Z) = "CUS"
0026:
0027: Z+=1 ; F(Z) = "ORDER.DATE" ; N(Z) = "11" ; T(Z) = "D"
0028: Z+=1 ; F(Z) = "XX<ITEM" ; N(Z) = "35.1" ; T(Z) = "A"
0029: Z+=1 ; F(Z) = "XX_QUANTITY" ; N(Z) = "16.1" ; T(Z) = ""
0030: Z+=1 ; F(Z) = "XX>CONFIRMED" ; N(Z) = "3" ; T(Z)<2> = "YES_NO"
0031: Z+=1 ; F(Z) = "LOCAL"
"LOCAL" ; N(Z)
N(Z) = "10" ; T(Z) = "A"
"A" ; T(Z)<3> = "NOIN
"NOIN PUT"

Compile the routine.

STEP 2

>ED BP TEMPLATE
Page 1 of 7
----:SAVE BP ORDERS.ZZ
----:Q
 ED BP ORDERS.ZZ

In the para GOSUB Define.parameters remove the REM statement, and insert the name of the
field definitions as ORDZZ.FIELD.DEFINITIONS

DEFINE.PARAMETERS:* SEE 'I_RULES' FOR DESCRIPTIONS *


0393:
0394: CALL ORDZZ.FIELD.DEFINITIONS
0395:
0396: RETURN

 Next for the purpose of standard Globus format for ID, we call the subroutine
EB.FORMAT.ID in the paragraph GOSUB CHECK.ID

CHECK.ID:
Validation and changes of the ID entered. Set ERROR to 1 if in error.

CALL EB.FORMAT.ID ("ORDZZ")

IF E THEN
ERROR = 1
CALL ERR 
END

RETURN

Compile the routine.

STEP 3

In Globus create a record in PGM.FILE with the name ORDERS.ZZ as under. Authorise the
record.
ORDERS.TR
--------------------------------------------------------------------------
1 TYPE.............. H
2.1 GB SCREEN.TITLE ORDERS TRAINING TEMPLATE
3 ADDITIONAL.INFO...
4.1 BATCH.JOB......
5 PRODUCT........... EB
6 SUB.PRODUCT.......

H type indicates the inclusion of all 3 files namely LIVE/UNAUTH/HIS

STEP 4

To create a file control, we will open an existing file.control as under -

>ED F.FILE.CONTROL ACCOUNT


21 lines long.

----: SAVE F.FILE.CONTROL ORDERS.TR


"ORDERS.TR" filed in file "F.FILE.CONTROL".

Page 2 of 7
----: Q

 Now open the file control file and make the following changes.

>ED F.FILE.CONTROL ORDERS.TR


21 lines long.
----:
0001: THE ACCOUNT FILE
----: C/ACCOUNT/ORDERS.TR
0001: THE ORDERS.TR FILE
0002: AC
----: C/AC/EB ------------  As mentioned in PGM.FILE
0002: EB
0003: $HISÿ$NAU -------- For a H type file in PGM.FILE
0004: 2
0005: 17
0006: FIN
0007:
----: FI
"ORDERS.TR" filed in file "F.FILE.CONTROL".

STEP 5

Run the FILE.LAYOUT to create the I_<file> as under 

>FILE.LAYOUT

FILE LAYOUT - CREATING I_F FILE

NAME OF THE FILE (E.g. BP, BANK.BP):


?
At this system prompt, mention the file as BP

At the next prompt Enter Program/File(s) :


Give the program name ORDERS.ZZ

 The system prompts as under


Build Insert from File (D)ictionarys or (P)rograms or (Q)uit
<CR = (P)rograms> :
Mention P

At the next prompt


Enter output Name - <CR> = I_F.Entryname:
Enter return

Next prompt by the system is


Enter PREFIX or <CR> = NONE :
Mention an appropriate prefix ORDTR

 The system then Processes the matrix entries for ORDERS.ZZ program

STEP 6

In Globus run the application CREATE.FILES at the command prompt. The system prompts
for 

COMPANY NAME

Page 3 of 7
Mention the Bank name (by its Mnemonic)

CREATE FILES FOR Globus Demo Account

It next prompts for


LIST NAME
Give return

It prompts for
FILE NAME – ORDERS.ZZ

USING FILE NAME(S) INPUT

CONTINUE (Y/N) Y

The following message will be flashed stating that the dict & data files are being created as
 per the file control details regarding modulo/separation given therein and also files for $NAU
& $HIS types.

Creating dictionary for F.ORDERS.TR


Creating file "D_F.ORDERS.TR" as Type 3, Modulo 1, Separation 2.
Added "@ID", the default record for RetrieVe, to "D_F.ORDERS.TR".
Copying to ../demo.dict/D_F.ORDERS.TR
Deleting local dictionary D_F.ORDERS.TR

Creating file FBNK.ORDERS.TR


WARNING: An operating system file will be created with a truncated name.
Creating file "FBNK.ORDE000" as Type 2, Modulo 17, Separation 4.
Copying to ../demo.data/eb/FBNK.ORDE000
Deleting local file FBNK.ORDE000

Creating file FBNK.ORDERS.TR$HIS


WARNING: An operating system file will be created with a truncated name.
Creating file "FBNK.ORDE000" as Type 2, Modulo 17, Separation 4.
Copying to ../demo.data/eb/FBNK.ORDE001
Deleting local file FBNK.ORDE000

Creating file FBNK.ORDERS.TR$NAU


WARNING: An operating system file will be created with a truncated name.
Creating file "FBNK.ORDE000" as Type 2, Modulo 17, Separation 4.
Copying to ../demo.data/eb/FBNK.ORDE002
Deleting local file FBNK.ORDE000

STEP 7

In GLOBUS open the application STANDARD SELECTION in the name ORDERS.ZZ and
set FIELD.NO.28 to Y. The system automatically generates the DICT file for the fields
which can be referenced later on.

ORDERS.ZZ application is now ready for input.

EXERCISE 2

Introduce a CHECKFILE for the input of the customer ID and enrichment displayed for the
same. Also we will introduce automatic ID generation.

Page 4 of 7
 Solution :

Open the routine ORDZZ.FIELD.DEFINITIONS and include the following CHECKFILE

0027: Z += 1 ; F(Z) = "CUSTOMER.NO" ; N(Z) = 10.1."; T(Z) = "CUS”


0028: CHECKFILE(Z) = CHK.CUSTOMER  

Insert the following line after the field.definitions

CHK.CUSTOMER = "CUSTOMER":FM:EB.CUS.SHORT.NAME:FM:'.A'
Compile the routine.

 Now while inputting a record into the ORDERS.ZZ application in Globus the system checks
the input made into the customer field for the existence in the CUSTOMER application and
thereupon display the enrichment of the short name.

For ID generation in Globus open the application AUTO.ID.START

Auto ID Start INPUT

KEY............... ORDERS.TR
--------------------------------------------------------------
1. 1 DESCRIPTION.... ORDERS TRAINING TEMPLATE
2. 1 APPLICATION.... ORDERS.TR
3. 1 ID.START....... ORDTR0005300001
4 RECORD.STATUS.....

Open the COMPANY record and include the template under PGM.AUTO.ID field.

COMPANY.CODE...... GB-001-0001 Great Britain ----------------

13.29 PGM.AUTOM.ID... ORDERS.ZZ

 Now the template can be run with an automatic ID generation

EXERCISE 3

Add a routine using CHECKFIELD to populate the order date with the current date.

 Solution :

>ED BP XX.CHECK.FIELDS
113 lines long.

----: SAVE BP ORDZZ.CHECK.FIELDS


"ORDZZ.CHECK.FIELDS" filed in file "BP".
----: Q

In ORDZZ.CHECK.FIELDS make the following changes

Include $INSERT I_F.ORDERS.ZZ


Page 5 of 7
Include the condition for populating the field with current day by using the condition COMI
= TODAY as under 

DEFAULT.FIELDS:
0072: *
0073: BEGIN CASE
0074: CASE AF = ORDTR.ORDER.DATE
0075: COMI = TODAY
0076:
0077: END CASE
0078:
0079: CALL REFRESH.FIELD(AF,'')
0080:
0081: RETURN

Compile the routine.

Open the routine ORDZZ.FIELD.DEFINITIONS and include the following in the N


 parameter and compile it.

0028: Z += 1 ; F(Z) = “ORDER.DATE” ; N(Z) = “10.1.C” ; T(Z) = “D”

Open ORDERS.ZZ and remove the REM statement in GOSUB CHECK.FIELDS and call
ORDZZ.CHECK.FIELDS.

CHECK.FIELDS:

CALL ORDZZ.CHECK.FIELDS

IF E THEN
T.SEQU = "IFLD"
CALL ERR 
END

RETURN

Compile the routine.

 Now the routine can execute the requirement.

EXERCISE 4

Include a routine to cross validate that the input of quantity above 1000 needs to be
confirmed.

 Solution :

>ED BP XX.CROSSVAL
127 lines long.

----: SAVE BP ORDZZ.CROSSVAL


"ORDZZ.CROSSVAL" filed in file "BP".
----: Q
>ED BP ORDZZR.CROSSVAL

Page 6 of 7
0030:REAL.CROSSVAL:
0031: *
0032: * Real cross validation goes here....
0033: *
0034: AF = ORDTR.QUANTITY
0035: NO.OF.AV = DCOUNT(R.NEW(AF),VM)
0036: FOR AV = 1 TO NO.OF.AV
0037: IF R.NEW(ORDTR.QUANTITY)<1,AV> > 1000 AND
R.NEW(ORDTR.CONFIRMED)<1,AV> = "NO" THEN
0038: AF = ORDTR.QUANTITY
0039:
0040: ETEXT = "QNTY ABOVE 1000 NEEDS CONFIRMATION"
0041: CALL STORE.END.ERROR
0042: END
0043: NEXT AV
0044: RETURN
0045: *

Compile the routine.

Reopen the template ORDERS.ZZ and remove the REM statement in the GOSUB CROSS
VALIDATION.

In the paragraph CROSS.VALIDATION call ORDZZ.CROSSVAL.

Compile the template.

 Now the application will meet the requirement.

Page 7 of 7

You might also like