Restructure Input-Events (EXIRST)

Characteristics

This exit is available in COBOL and C language.

Restriction: This exit is only available in File mode.

Description

Once the Input-Event segments have been read, this exit can be used to:

  • Format the segments and enrich the data
  • Delete segments
  • Add segments
  • Allocate identifiers to Input-Events (written in the segments)

Example of Input-Event restructuring:

  • From the N segments that are read, you can produce between 0 and M segments
  • A multi-segment Input-Event can be produced from the data in a single segment
  • Inversely, a single-segment Input-Event can be built from multiple physical segments that have been read

The identifiers associated with an Input-Event to be processed can be defined by setting the identifier fields, which are mandatory in the segment (for offsets and lengths of the identifiers, refer to the sys.dat file).

Operating principle

The exit is called for each segment that is read during the session.

Segments are read in the input exchange area and transmitted to the EXIRST exit. They can be restructured and copied back in output area.

Specific features

If an anomaly is detected in this exit, the session is rejected.

The data in the rejected Input-Event is restructured data. Consequently, when programming this exit, you must handle the case in which Input-Events that have already been restructured are being reprocessed.

Exchanged data

Four entry points are available:

  • Init
  • Read
  • Write
  • Close

EXI_nINIT entry point

Called at the beginning of the session, it initializes the module.

EXI_nLECTURE entry point

Called when handling data in the Input-Event exchange area, it is used to store, enrich and restructure the segments that are read.

Alphanumeric fields may have different descriptions depending on the programing language and the Latin or UTF-16 format used. For more information, refer to Exits and external calls.

INPUT data

Name in C

Name in

COBOL

Characteristics / Length Use

szSourceCode

* L-CDEMETTEUR

Alphanumeric / 25

Processing-Context-In code associated with the session

nEntryCode

* L-TYPTRT

Numeric / 1

Entry point code:

  • 5: EXI_nLECTURE,
    call in read mode
  • 2: TRT-READRST
    (COBOL : UNIX / MVS)
  • 2 : TRT-READ
    (COBOL: Windows)

sSegment

* L-CRE

Alphanumeric / 4000 max.

Content of the segment read

nSegmentLght

* L-LGCRE

Numeric / 4

Length of the segment read
(maximum value = 4000)

 

OUTPUT data

Name in C Name in COBOL Characteristics / Length Use

nNbSegmentToWrite

* L-NBCRE

Numeric / 5

Number of segments to be written:

  • 0: Request to read the next segment
  • 1: Request to write the restructured segment
  • M: Request to write M segments

sSegment

* L-CRE

Alphanumeric / 4000 max

Content of the first restructured segment to be written

nSegmentLght

* L-LGCRE

 

Numeric / 4

Length of the first restructured segment
(maximum value = 4000)

szErrorLabel

* L-MSGERR

 

Alphanumeric / 200

Error message if an error is detected

Return value

 

 

  • 0 (EXI_nNOERREUR)
  • 9 (EXI_nERREURSYSTEME), if a system error is detected, in which case the session is closed

 

EXI_nECRITURE entry point

Called when writing segments in I_Tmp_Ievent_Restructuring, it is used to enrich the segments after restructuring.

Alphanumeric fields may have different descriptions depending on the programing language and the Latin or UTF-16 format used. For more information, refer to Exits and external calls.

INPUT data

Name in C Name in COBOL Characteristics / Length Use

szSourceCode

* L-CDEMETTEUR

 

Alphanumeric / 25

Processing-Context-In code associated with the session

nEntryCode

* L-TYPTRT

Numeric / 1

Entry point code 6: EXI_nECRITURE, call in write mode

nNbSegmentToWrite

* L-NBCRE

Numeric / 5

Index of the restructured segment to be written if more than 1

 

OUTPUT data

Name in C Name in COBOL Characteristics / Length Use

 

 

 

 

sSegment

* L-CRE

Alphanumeric / 4000 max.

Content of the restructured segment to be written

nSegmentLght

* L-LGCRE

Numeric / 4

Length of the restructured segment to be written

szErrorLabel

* L-MSGERR

Alphanumeric / 200

 

Error message if an error is detected

Return value

 

 

  • 0 (EXI_nNOERREUR)
  • 9 (EXI_nERREURSYSTEME), if a system error is detected, in which case the session is closed

 

EXI_nFERM entry point

Called at the end of the session, it closes the module.

Implementation

Processing phases for calls submitted during a session

The Input-Event exchange area (Processing-Context-In) is read until it no longer contains any segments.

EXI_nLECTURE call

This entry point is used each time a segment is read in the Input-Event exchange area (Sender).

If you do not change the value of the nNbSegmentToWrite field in the output area, the current segment (sSegt) is written directly in the I_Tmp_Ievent_Restructuring exchange area.

If you read another segment, you must store the restructured segments in memory in the exit.

Note   You can therefore execute N reads and one write, or inversely, one read and M writes.

EXI_nECRITURE call

This entry point is used when writing each segment restructured by EXI_nLECTURE.

The value of the nNbSegmentToWrite field indicates the index of the restructured segment to be written.

If necessary, you can change the content of this segment before returning it to the write module.

Parameter settings

This exit can be executed during step E.

script.ges file

Keyword Description/ Value to be defined
>Script.ges< Section

 

I_Tmp_Ievent_Restructuring

Name of the temporary file into which the restructured Input-Events are written

sys.dat file

Keyword Description/ Value to be defined
>ScriptConfiguration<Section<

 

I_Exit_Restructuring_Ievent

  • Yes_C or Yes_cobol: Execute EXIRST exit
  • No: Do not execute the exit

Module names

Implementation

Platform Directory / Library Name C Program COBOL Program

Windows

%RDJ_EXEC%\exit

EXIRSTC.c
exidllh.h (header file)

EXIRST.cbl

UNIX

$RDJ_EXEC/exit

EXIRSTC.c
exidllh.h (header file)

EXIRST.cbl

MVS

&RDJEXEC..SRCLIB

EXIRSTC
exidllh.h (header file)

EXIRST.cbl

 

Processing Type Label Entry Point

Open

TRT-INIT

EXI_nINIT

Close

TRT-FIN

EXI_nFERM

Read segment

TRT-READ

EXI_nLECTURE

Write restructured segment

TRT-WRITE

EXI_nECRITURE

Related Links