Wednesday, 15 June 2011

How to assign a field inside a nested record in COBOL -



How to assign a field inside a nested record in COBOL -

i'm quite noob on cobol bought myself 1 of "for dummies" type book lacks depth.

i'm trying assign , retrieve value of field nested record. i'm trying per book suggested, :

write report-line date of header after advancing page. write report-line establishment of header after 1. write report-line branch of header after 1. write report-line partition of header after 1. write report-line filler-line

the layout header one:

01 header. 02 date. 03 o-month pic zz. 03 filler pic x(01) value '/'. 03 o-day pic 99. 03 filler pic x(01) value '/'. 03 o-year pic 99. 03 filler pic x(116) value spaces. 03 page pic a(4) value 'page'. 03 filler pic x(1) value space.

so question is, how illustration access 0-day field of record date header?

both assignment , retrieval. like:

move 21 0-day of date of header.

firstly avoid data-names "words". date instance word, somethng-date or date-something not.

date reserved word in cobol, think unlikely illustration compile. word header become reserved in future (although these days standards commission seek avoid that).

header group-item. date grouping item. other fields simple items. don't regard structures such "nested", group-items must contain @ to the lowest degree 1 simple item.

the time need utilize of/in when there non-unique names (which should avoid).

so:

move 21 0-day

will work, long 0-day not duplicate name. syntax showed work, why add together no point, increasing possibility of typo, , making next reader think programme has non-unique names.

try avoid full-stops/periods in procedure partition except necessary (after procedure partition header, before paragraph/section after paragraph/section label, before end of program).

cobol

No comments:

Post a Comment