Advanced VSAM Topics

The following topics discuss two specialized techniques associated with describing external data sources.

In this section:

Combining RECTYPE and OCCURS Segments in VSAM

Reading Complex Data Sources With User-Written Procedures in VSAM

Combining RECTYPE and OCCURS Segments in VSAM

It is possible to describe external data sources that have two different types of descendant segments to FOCUS. The first segments are made up of multiple-occurrence fields within a single record of a given type. These you describe with the OCCURS attribute. You could also have descendant segments, describing separate, but related, records distinguished by a field that determines their record type. You describe this type of descendant segment using a RECTYPE field declaration in the Master File to describe the external field.

The external data structure below has both types of segments. The first record, of type 01, contains several different sequences of repeating fields, all of which are described in the FOCUS structure as descendant segments, possessing an OCCURS attribute. The file also contains two separate types of records, (02 and 03) that contain information related to that in record type 01. This relationship was established in the external data structure. Here, we are simply concerned with describing that relationship to FOCUS.

The relationship between the records of various types is also expressed as a parent-child relationship. The children containing record types 02 and 03 will not have OCCURS attributes. They are distinguished from their parent by the field declaration: FIELDNAME=RECTYPE.

01

T1

N1

B1

B2

C1

C1

C1

D1

D1

D1

D1

D1

D1

D1

B1

B2

C1

C1

D1

D1

D1

D1

D1

 

 

 

 

 

 

 

 

 

 

 

 

 

 


02

E1

 

03

F1

 

The Master File for this data source is:

FILENAME=EXAMPLE1, SUFFIX=FIX,$
SEGNAME=A, SEGTYPE=S0 ,$
FIELDNAME=RECTYPE ,ALIAS=01 ,ACTUAL=A2 ,USAGE=A2 ,$
FIELDNAME=T1 ,ALIAS= ,ACTUAL=A1 ,USAGE=A2 ,$
FIELDNAME=N1 ,ALIAS= ,ACTUAL=A1 ,USAGE=A1 ,$
SEGNAME=B, SEGTYPE=S0, PARENT=A,OCCURS=VARIABLE,$
FIELDNAME=B1 ,ALIAS= ,ACTUAL=I2 ,USAGE=I2 ,$
FIELDNAME=B2 ,ALIAS= ,ACTUAL=I2 ,USAGE=I2 ,$
SEGNAME=C, SEGTYPE=S0, PARENT=B,OCCURS=B1,$
FIELDNAME=C1 ,ALIAS= ,ACTUAL=A1 ,USAGE=A1 ,$
SEGNAME=D, SEGTYPE=S0, PARENT=B,OCCURS=7,$
FIELDNAME=D1 ,ALIAS= ,ACTUAL=A1 ,USAGE=A1 ,$
SEGNAME=E, SEGTYPE=S0, PARENT=A,$
FIELDNAME=RECTYPE ,ALIAS=02 ,ACTUAL=A2 ,USAGE=A2 ,$
FIELDNAME=E1 ,ALIAS= ,ACTUAL=A1 ,USAGE=A1 ,$
SEGNAME=F, SEGTYPE=S0, PARENT=E,$
FIELDNAME=RECTYPE ,ALIAS=03 ,ACTUAL=A2 ,USAGE=A2 ,$
FIELDNAME=F1 ,ALIAS= ,ACTUAL=A1 ,USAGE=A1 ,$

It produces the following FOCUS data structure:

08main17_wmf.gif

Segments A, B, C, and D all belong to the same physical record. Segments E and F are each stored on separate physical records in the external file.

Notes regarding this FOCUS data structure:


Top of page

Reading Complex Data Sources With User-Written Procedures in VSAM

There are various ways to read complex external data sources with user-written procedures. You can invoke a user exit and combine user-written code with data driver logical functions. These techniques are described in User Exits for Non-FOCUS Data Sources.

You could also write your own routine to provide records to the FOCUS report writer from any source, which FOCUS will treat exactly as if they resided in a FOCUS data source. These user-written routines must be coded as subroutines in C, FORTRAN, COBOL or BAL, and they pass data to the FOCUS calling program through arguments in the subroutine. User Exits for Non-FOCUS Data Sources provides an example of implementing this approach in FORTRAN. When taking this approach, be sure to refer to the PTF documentation in the READMEF file for OS/390 Installation concerning any applicable language environment (LE) fixes

User Exits for Non-FOCUS Data Sources also demonstrates the use of a decompression exit (ZCOMP1) for working with compressed VSAM data sources and flat files.


Information Builders