Qdoc - Tips - Workshop Template Programming
Qdoc - Tips - Workshop 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.
>ED BP ORDZZ.FIELD.DEFINITIONS
ORDZZ.FIELD.DEFINITIONS
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"
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
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.
IF E THEN
ERROR = 1
CALL ERR
END
RETURN
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.......
STEP 4
Page 2 of 7
----: Q
Now open the file control file and make the following changes.
STEP 5
>FILE.LAYOUT
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)
It prompts for
FILE NAME – ORDERS.ZZ
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.
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.
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 :
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.
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.
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.
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
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
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.
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: *
Reopen the template ORDERS.ZZ and remove the REM statement in the GOSUB CROSS
VALIDATION.
Page 7 of 7