フィールドに実際に命令が実行される場合を除き、次の例に示す考慮事項 は CLEAR 命令にも適用されます。 図 341 に、「*NOKEY を 伴う RESET 命令」の例を示します。
*...1....+....2....+....3....+....4....+....5....+....6....+....7...+.... FFilename++IPEASFRlen+LKlen+AIDevice+.Keywords++++++++++++++++++++++++++++ FEXTFILE O E DISK DName+++++++++++ETDsFrom+++To/L+++IDc.Functions+++++++++++++++++++++++++++ * The file EXTFILE contains one record format RECFMT containing * the character fields CHAR1 and CHAR2 and the numeric fields * NUM1 and NUM2. It has keyfields CHAR2 and NUM1. D D DS1 DS D DAY1 1 8 INZ('MONDAY') D DAY2 9 16 INZ('THURSDAY') D JDATE 17 22 D CL0N01Factor1+++++++Opcode(E)+Factor2+++++++Result++++++++Len++D+HiLoEq... * * The following operation sets DAY1, DAY2, and JDATE to blanks. C C CLEAR DS1 C * The following operation will set DAY1, DAY2, and JDATE to their * reset values of 'MONDAY', 'THURSDAY', and UDATE respectively. * The reset value of UDATE for JDATE is set in the *INZSR. C C RESET DS1 C * The following operation will set CHAR1 and CHAR2 to blanks and * NUM1 and NUM2 to zero. C CLEAR RECFMT * The following operation will set CHAR1, CHAR2, NUM1, and * NUM2 to their reset values of 'NAME', 'ADDRESS', 1, and 2 * respectively. These reset values are set in the *INZSR. * C RESET RECFMT * The following operation sets all fields in the record format * to blanks, except the key fields CHAR2 and NUM1. * C *NOKEY RESET *ALL RECFMT C RETURN C C *INZSR BEGSR C MOVEL UDATE JDATE C MOVEL 'NAME ' CHAR1 C MOVEL 'ADDRESS ' CHAR2 C Z-ADD 1 NUM1 C Z-ADD 2 NUM2 C ENDSR ORCDNAME+++D...N01N02N03EXCNAM++++........................................ O..............N01N02N03FIELD+++++++++.B.................................. ORECFMT T O CHAR1 O CHAR2 O NUM1 O NUM2
A R RECFMT A CHAR1 10A A CHAR2 10A A NUM1 5P 0 A NUM2 7S 2
図 343 に、2 つの外部記述ファイル RESETIB と RESETON を使用するプログラムのソース・リストの抜粋を示します。 それぞれには 2 つのレコード様式があって、それぞれのレコード様式には入力 フィールド FLDIN、出力フィールド FLDOUT、および入出力可能なフィールド FLDBOTH が入っています。 この DDS を 図 344 および 図 345 に示し ます。
RESETIB は入出力共用ファイルとして定義されているので、入出力可能として 定義されている RECBOTH のフィールドは、入力と出力の両方の指定に使用する ことができます。 逆に、RECIN のフィールドは入力の指定にしか使用することができません。
1 * The file RESETIB contains 2 record formats RECIN and RECBOTH. 2 FRESETIB CF E WORKSTN 3 * The file RESETON contains 2 record formats RECOUT and RECNONE. 4 FRESETON O E WORKSTN 5 6=IRECIN 7=I A 1 1 *IN02 8=I A 2 11 FLDIN 9=I A 12 21 FLDBOTH 10=IRECBOTH 11=I A 1 1 *IN04 12=I A 2 11 FLDIN 13=I A 12 21 FLDBOTH 14 C WRITE RECOUT 15 C WRITE RECBOTH 16 C READ RECIN ----99 17 C READ RECBOTH ----99 18 19 * RESET without factor 2 means to reset only those fields which 20 * appear on the output specifications for the record format. 21 * Since only RECOUT and RECBOTH have write operations, the 22 * RESET operations for RECNONE and RECIN will have no effect. 23 * The RESET operations for RECOUT and RECBOTH will reset fields 24 * FLDOUT and FLDBOTH. FLDIN will not be affected. 25 C RESET RECNONE 26 C RESET RECIN 27 C RESET RECOUT 28 C RESET RECBOTH 29 30 * RESET with *ALL in factor 2 means to reset all fields. Note 31 * that this can only be done when all fields are used in at least 32 * one of the ways they are defined (for example, an output-capable 33 * field must be used for output by the record format) 34 * Since RECNONE does not have either input or output operations, 35 * the RESET *ALL for RECNONE will fail at compile time. 36 * Since RECIN does not have any output operations, RESET *ALL RECIN 37 * will fail because FLDOUT is not output. 38 * Since RECOUT does not have any input operations, and is not defined 39 * as input capable on the file specification, RESET *ALL RECOUT 40 * will fail because FLDIN is not input. 41 * The RESET *ALL for RECBOTH will reset all fields: FLDIN, FLDOUT 42 * and FLDBOTH. 43 C RESET *ALL RECNONE 44 C RESET *ALL RECIN 45 C RESET *ALL RECOUT 46 C RESET *ALL RECBOTH 47 48 C SETON LR---- 49=ORECBOTH 50=O *IN14 1A CHAR 1 51=O FLDOUT 11A CHAR 10 52=O FLDBOTH 21A CHAR 10 53=ORECOUT 54=O *IN13 1A CHAR 1 55=O FLDOUT 11A CHAR 10 56=O FLDBOTH 21A CHAR 10
ソースのコンパイル時にはいくつかのエラーが示されます。 RECNONE と RECIN の両方には出力フィールドなしと示されます。 RESET *ALL は、RECBOTH レコードを除くすべてのレコードに使用できません。 これは、すべてのフィールドが入力または出力のいずれかの指定に現れる 唯一のレコード様式であるためです。
A R RECIN CF02(02) A FLDIN 10A I 2 2 A FLDOUT 10A O 3 2 A 12 FLDBOTH 10A B 4 2 A R RECBOTH CF04(04) A FLDIN 10A I 2 2 A FLDOUT 10A O 3 2 A 14 FLDBOTH 10A B 4 2
A R RECNONE CF01(01) A FLDIN 10A I 2 2 A FLDOUT 10A O 3 2 A 11 FLDBOTH 10A B 4 2 A R RECOUT CF03(03) A FLDIN 10A I 2 2 A FLDOUT 10A O 3 2 A 13 FLDBOTH 10A B 4 2
(C) Copyright IBM Corporation 1992, 2006. All Rights Reserved.