In rare occasions, for example after improper rename of datasets, you may face the need to ascertain that the MCF datasets named in the C1DEFLTS table effectively correspond to the stages where they are named.
It must be said that Endevor does not check this point. It only ensures that each MCF is related to the ELMCATL dataset named in the C1DEFLTS table, but doesn't check that the MCFs correspond to their stage so a mess of MCFs within C1DEFLTS could raise strange situations.
For example, error "C1G0002E ERROR OBTAINING MASTER FILE DEFINITION FOR SYSTEM system_name, ENVIRONMENT env_name" would arise if MCFs have been misplaced so that a system definition record is found in the MCF for one stage and is missing in the MCF for the other stage in a given environment.
Even though environments and stages are defined in C1DEFLTS table, each MCF contains a 'stage definition record' which contains information extracted from C1DEFLTS table. This information is added when the MCF is opened by the first time after IDCAMS DEFINE and is refreshed whenever job BC1JXCNM is run in UPDATE mode to register the MCFs to a new element catalog DSN. The key of the stage definition record is a string of 28 blanks,
You can therefore use any utility, for example, IDCAMS PRINT, to extract the contents of the stage record and use it to (try to) determine the stage to which a particular MCF belongs.
The relevant fields to examine in the record are
POSITION | LENGTH | DESCRIPTION |
29 | 8 | Previous stage name |
37 | 44 | Previous stage MCF dataset name |
81 | 8 | Current stage name |
89 | 44 | Current stage MCF dataset name |
133 | 8 | Next stage name |
141 | 44 | Next stage MCF dataset name |
185 | 1 | Current stage ID |
186 | 8 | Current stage title |
242 | 44 | Element catalog DSN |
All the fields contain character data. The positions are relative to the start of the record. Depending on the utility used (for example, it may happen with SORT) you may need to add 4 bytes to account for the RDW (Record Descriptor Word) since VSAM records are of variable length
The 'previous', 'current' and 'next' stage fields behave differently depending on whether the MCF is from stage 1 or stage 2 in an environment:
For example, if an environment is defined in C1DEFLTS as
C1DEFLTS TYPE=ENVRNMNT,
...
STG1ID='1',
STG1NME='STG1',
STG1TTL='STAGE 1', ,
STG1VSM='PUBLIC.K5400893.V190.STG1.MCF',
STG2ID='2',
STG2NME='STG2',
STG2TTL='STAGE 2',
STG2VSM='PUBLIC.K5400893.V190.STG2.MCF'
The JCL to print the stage definition record from both MCFs would be:
//STEP1 EXEC PGM=IDCAMS
//SYSPRINT DD SYSOUT=*
//SYSIN DD *
PRINT -
IDS(PUBLIC.K5400893.V190.STG1.MCF) -
FROMKEY(' *') -
TOKEY(' *')
PRINT -
IDS(PUBLIC.K5400893.V190.STG2.MCF) -
FROMKEY(' *') -
TOKEY(' *')
/*
Note that, as per IDCAMS rules, FROMKEY and TOKEY specify a generic key starting with a blank. This combination obtains the stage definition record, which is the only record in the MCF having a blank in the first byte of the key.
The resulting output would be
LISTING OF DATA SET -PUBLIC.K5400893.V190.STG1.MCF
KEY OF RECORD - 40404040404040404040404040404040404040404040404040404040
000000 40404040 40404040 40404040 40404040 40404040 40404040 40404040 40404040 * *
000020 40404040 40404040 40404040 40404040 40404040 40404040 40404040 40404040 * *
000040 40404040 40404040 40404040 40404040 E2E3C7F1 40404040 D7E4C2D3 C9C34BD2 * STG1 PUBLIC.K*
000060 F5F4F0F0 F8F9F34B E5F1F9F0 4BE2E3C7 F14BD4C3 C6404040 40404040 40404040 *5400893.V190.STG1.MCF *
000080 40404040 E2E3C7F2 40404040 D7E4C2D3 C9C34BD2 F5F4F0F0 F8F9F34B E5F1F9F0 * STG2 PUBLIC.K5400893.V190*
0000A0 4BE2E3C7 F24BD4C3 C6404040 40404040 40404040 40404040 F1E2E3C1 C7C540F1 *.STG2.MCF 1STAGE 1*
0000C0 40404040 40404040 40404040 40400028 40404040 40404040 40404040 40404040 * .. *
0000E0 40404040 40404040 40404040 40404040 40D7E4C2 D3C9C34B D2F5F4F0 F0F8F9F3 * PUBLIC.K5400893*
000100 4BE5F1F9 F04BC5D3 D4C3C1E3 D3404040 40404040 40404040 40404040 40 *.V190.ELMCATL *
LISTING OF DATA SET -PUBLIC.K5400893.V190.STG2.MCF
KEY OF RECORD - 40404040404040404040404040404040404040404040404040404040
000000 40404040 40404040 40404040 40404040 40404040 40404040 40404040 E2E3C7F1 * STG1*
000020 40404040 D7E4C2D3 C9C34BD2 F5F4F0F0 F8F9F34B E5F1F9F0 4BE2E3C7 F14BD4C3 * PUBLIC.K5400893.V190.STG1.MC*
000040 C6404040 40404040 40404040 40404040 E2E3C7F2 40404040 D7E4C2D3 C9C34BD2 *F STG2 PUBLIC.K*
000060 F5F4F0F0 F8F9F34B E5F1F9F0 4BE2E3C7 F24BD4C3 C6404040 40404040 40404040 *5400893.V190.STG2.MCF *
000080 40404040 40404040 40404040 40404040 40404040 40404040 40404040 40404040 * *
0000A0 40404040 40404040 40404040 40404040 40404040 40404040 F2E2E3C1 C7C540F2 * 2STAGE 2*
0000C0 40404040 40404040 40404040 40400028 40404040 40404040 40404040 40404040 * .. *
0000E0 40404040 40404040 40404040 40404040 40D7E4C2 D3C9C34B D2F5F4F0 F0F8F9F3 * PUBLIC.K5400893*
000100 4BE5F1F9 F04BC5D3 D4C3C1E3 D3404040 40404040 40404040 40404040 40 *.V190.ELMCATL *
As you can see, STG1.MCF corresponds to stage 1 and STG2.MCF corresponds to stage 2, previous stage name and MCF DSN are blank for STG1,MCF while next stage name and MCF DSN are blank for STG2.MCF