JCL

XML statement generation using SORT

We will generate XML statement from input records having fixed positions using SORT. We will use REMOVECC, HEADER1, BUILD, JFY, SHIFT, LEFT, LEAD, TRAIL, LENGTH, SQZ & TRAILER1 parameters.

REMOVECC: The REMOVECC parameter generates reports that do not include ANSI carriage control characters that specify printer actions (for example, skipping a line or ejecting a page).

HEADER1: HEADER1 provides a header or a possible title page for the entire report. It appears only once at the beginning of the report on its own page.

BUILD: BUILD is an alias for OUTREC. This parameter lets you create multiple output files & indicates how the records are to be formatted in each output file.

JFY: The JFY sub-parameter specifies that an input field be processed for left-justification or right-justification for the output record.

SHIFT: Specifies the justification SHIFT=LEFT indicates that you want to left-justify SHIFT=RIGHT indicates that you want to right-justify.

LEFT: Specifies left-justification of the input field. Leading blank characters are eliminated; all remaining characters are shifted left.

LEAD: LEAD=string specifies the leading string as a character or hexadecimal constant (1 to 50 bytes). 

TRAIL: TRAIL=string specifies the trailing string as a character or hexadecimal constant.

LENGTH: LENGTH sub-parameter to alter the length of the output field. 

SQZ: The squeeze feature is used to replace groups of blanks between the first nonblank and last nonblank with other characters. 

TRAILER1: It provides a trailer or a possible summary for the entire report. It appears only once at the end of the report on its own page.

This is a 80-byte FB input file containing below mentioned records.

ExampleXML statement

Input Data: 
Artificial Intelligence           Norman      JR
Robotics                          Steve       O
Hacking                           Adam        G

SYSIN Data:
   OPTION COPY
   OUTFIL REMOVECC,
   HEADER1=(C'<?xml version="1.0"?>',/,
   3:C'<Expertise>'),
   BUILD=(5:C'<Specialization>',/,
   7:1,20,JFY=(SHIFT=LEFT,LEAD=C'<subject>',TRAIL=C'</subject>',
   LENGTH=36),/,      
   7:24,15,SQZ=(SHIFT=LEFT,LEAD=C'<author>',MID=C', ',
   TRAIL=C’</author>',LENGTH=33),/ 
   5:C'</Specialization>'),
   TRAILER1=(3:C'</Expertise>')

OUTPUT XML statements:
<?xml version="1.0"?>
  <Expertise>
    <Specialization>
      <subject>Artificial Intelligence </subject>
      <author>Norman, JR</author>
    </Specialization>
    <Specialization>
      <subject>Robotics</subject>
      <author>Chatterjee, O</author>
    </Specialization>
    <Specialization>
      <subject>Hacking</subject>
      <author>Adam, G</author>
    </Specialization>
  </Expertise>

OUTFIL HEADER1 used to generate the xml and Expertise starting tags that precede the set of tags for each record. OUTFIL BUILD is used to generate the set of tags for each record as given below:

  • A constant is used to generate the Specialization starting tag.
  • JFY is used to generate the subject tags and data from the first input field. LEAD generates the subject starting tag before the input field from the record. TRAIL generates the subject ending tag after the last nonblank character from the input field. JFY keeps embedded blanks between the first nonblank character and the last nonblank character of the input field. LENGTH ensures that the addition of the LEAD and TRAIL strings does not cause truncation by increasing the output length to 36 bytes (overriding the default of 20 bytes from the input field).
  • SQZ is used to generate the author tags and data from the second and third input fields. LEAD generates the author starting tag before the input field from the record. MID replaces the blanks between the second and third input fields with a comma and one blank. TRAIL generates the author ending tag after the last nonblank character from the input fields. LENGTH ensures that the addition of the LEAD, MID and TRAIL strings does not cause truncation by increasing the output length to 33 bytes (overriding the default of 15 bytes from the input field).

OUTFIL TRAILER1 is used to generate the Expertise ending tag that follows the set of tags for each record.

JCL blogs – Click Here SYNCSORT Manual: Click Here

Admin

Share
Published by
Admin

Recent Posts

Increase Transparency and Collaboration Product Backlog

A well-maintained product backlog is crucial for successful product development. It serves as a single…

3 weeks ago

Product Backlog – Incremental value to the customer

Incremental value to the customer refers to the gradual delivery of small, functional parts of…

4 weeks ago

Product Market, Customer’s Desire, Need, and Challenges

A Product Market refers to the group of potential customers who might be interested in…

4 weeks ago

PAL-EBM Professional Agile Leadership – EBM Certification

The Professional Agile Leadership - Evidence-Based Management (PAL-EBM) certification offered by Scrum.org is designed for…

4 months ago

PAL I Professional Agile Leadership Certification

The Professional Agile Leadership (PAL I) certification, offered by Scrum.org, is designed to equip leaders…

4 months ago

Scrum Master Certification: CSM, PSM, SSM

Choosing the right Scrum Master Certification depends on your current experience and career goals. If…

6 months ago