From: Kellie Fitton on
Hi,

Yes, after you have accepted the screen from the endUser, then you can
validate all
of his/her data entry in the working-storage section (which is the
variables you have used
in the screen to receive the data input).

Additionally, some screen-section syntax can further help you with the
validation task
automatically, for example, the syntax FULL will force the endUser to
enter data and fill
the entire receiving field to match its length. Case in point:

WORKING-STORAGE SECTION.

01 300-ACTIVE-NUMERIC.
05 300-ZIPCODE PIC 9(5) VALUE 0.

SCREEN SECTION.

01 INPUT-SCREEN AUTO.
05 LINE 12 COLUMN 21 HIGHLIGHT 'ZIP CODE: '.
05 ZIPCODE REVERSE-VIDEO PIC Z(5)
USING 300-ZIPCODE FULL.

The endUser must enter five digits in the zipCode field in order for
him/her to proceed to
the next entry field, otherWise the system will sound a beep and will
NOT continue.

Kellie.

From: Richard on
I do not use SCREEN SECTION at all but have the screen areas in W-S.
The 'background' is defined as an 01 with a series of 03 with the VALUE
clauses, so it may be 2000 characters long - 25 x 80. This is
redefined as PIC X(2000) for the DISPLAY AT 0101. The screen is then
redefined again with FILLERs for everything except the input fields.
This is DISPLAYed to show the input fields - on a group DISPLAY AT 0101
only the non-FILLER are displayed.

I then accept each field in turn in a perform loop that uses
field-number to indicate which field I am on:
MOVE 1 TO field-number
PERFORM UNTIL field-number > 7
IF field-number = 1
ACCEPT first-field AT position
PERFORM Check-keys
(check-keys will test function-keys and may set
field-number to 99 (exit) or subtract 1 (previous)
or ...)
IF field-number = 1
validate field
if ok
add 1 to field-number
end-if
end-if
end-if

if field-number = 2
.....

This is rather tedious and it also sets the colours using PERFORM
Screen-xx where xx may be BG (background) FG (foreground, IN (input
field), err (error) etc.

For this I developed some simple code generating programs that take a
text file that has the layout and a list of field definitions and
creates a W-S screen area, code blocks for accepting the fields and so
on. eg (though it will probably wrap horribly):

*PREFIX
PM-
*FIELDS
- screenfield,order,movefield,type,paragraph,text
IKEY,0,P1-Key
IGroup,1,P1-Group,,PROC-GROUP,Product Group code - Scan for help, F6 to
delete product
DGROUP,0
IDim,30,P1-Dim,,,Use 'Y' to indicate non stock
IDesc,2,P1-Descr,PROC-DESC,,Description for Invoices
IClass,31,P1-Class,,,Product Classification
IBarCode,3,P1-BarCode,,PROC-BarCode,Barcode of product
IUNIT,32,P1-Unit,,,Unit
IBulk,4,P1-BulkRef,,,Product code of Bulk stock
ILabel,5,P1-Label-Ref,,,Product code of Label stock
ICarton,5,P1-Carton-Ref,,,Product code of Carton stock

IStdCost,6,P1-Cost1,4,,Standard cost
ITaxCode,33,P1-TaxCode,,Proc-Tax,Tax Code
DTaxRATE,0
IAveCost,6,P1-Cost2,4,,Average Cost
IDisc,34,P1-Disc,,PROC-DISC,Discountable Y/N
ILastCost,6,P1-Cost3,4,,Last cost
IPrice1,7,P1-Price(1),2,,Price 1
IPrice2,7,P1-Price(2),2,,Price 2
IPrice3,7,P1-Price(3),2,,Price 3
IRetail,8,P1-RetPrice,2,,Suggested Retail price

Isup,9,P1-Supplier,,Proc-Supplier,Supplier code - scan for next
DSup,0
IMinimum,35,P1-MinStock,0,,Minimum stock level required
ISCode,10,P1-Sup-Code,,,Supplier's code
ISDesc,11,P1-Sup-Desc,,,Supplier's description
ISPrice,12,P1-Sup-Price,2,,Supplier's price FOB or CIF
ISPer,13,P1-Sup-Per,0,,Price per quantity
ISCurr,14,P1-Sup-Curr,,PROC-CURR,Supplier's price currency
DSCurr,0
IOrigin,15,P1-Origin,,PROC-ORIGIN,Country of Origin
DOrigin,0
IDutyRate,16,P1-Duty-Rate,2,,Duty Rate

*SCREEN
-------------------------------------------------------------------------------
Product Code [%%%%%] PRODUCT
MAINTENANCE

Group [%%] %%%%%%%%%%%%%%%%%%%%%%%%%% Non-Dimishing [%]
Description [%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%] Class [%]
Barcode [%%%%%%%%%%%%%] Unit
[%%%]
Bulk Stock [%%%%%]
Label Stock [%%%%%]
Carton Stock [%%%%%]
Standard Cost [%%%%%%%%] Tax Code [%]
%%%%%
Average Cost [%%%%%%%%] Discountable [%]
Last Cost [%%%%%%%%]
Prices [%%%%%%%%] [%%%%%%%%] [%%%%%%%%]
Retail Price [%%%%%%%%]

Supplier .. [%%%] %%%%%%%%%%%%%%%%%%%%%%%%%% Minimum
[%%%%%%]
Vendor Part [%%%%%%%%%%%%%%%%%%]
Description [%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%]
FOB Price [%%%%%%%%]
Price per [%%%%%%]
Currency code [%%] %%%%%%%%%%%%%%%%%%
Origin [%%%%] %%%%%%%%%%%%%%%%%%
Duty Rate [%%%%%]
-------------------------------------------------------------------------------
*END



First  |  Prev  | 
Pages: 1 2
Prev: Visual Cobol
Next: data conversion