80 likes | 172 Views
Reading Data from File, Named Constants, and Printing Control. Week3. Reading Data from files (Sequential Read). Read sales; Dow not %eof(sales); enddo. Reading data from files (Random Read). The project file (projpf) has a key field, projid. To find the record where projid = ‘SUNNY’:
E N D
Reading Data from File, Named Constants, and Printing Control Week3
Reading Data from files (Sequential Read) Read sales; Dow not %eof(sales); enddo
Reading data from files(Random Read) • The project file (projpf) has a key field, projid. • To find the record where projid = ‘SUNNY’: projid = ‘SUNNY’; chain projid projpf; if %not found; endif;
Chain using composite key • Syntax Chain (studnbr:semester:coursenbr) studgrades; • The key fields to the file, STUDGRADES are: STUDNBR SEMESTER COURSENBR
Named Constants • Value never changes during processing • No specified length • Type determined by value
Initializing StandAlone Fields Use INZ keyword under keywords • You can initialize a field to a value • Some handy special values: • *sys (system date) • *null • *time (system time)
How Defined Data Structure to break up a date into fields. DdateStruct DS D systemDate D inz(*sys) D struct_year 4S 0 overlay(systemdate:1) D struct_month 2s 0 overlay(systemdate:6) D struct_day 2s 0 overlay(systemdate:9)
Page Overflow • OfLind Keyword and assign an indicator OfLind(*Inof) • Available indicators are: • OA, OB, OC, OD, OE, OF, OG, OV and01 - 99