Callable SORT
 COBOL and Sorting
http://www.simotime.com
When technology complements business    Copyright © 1987-2012  SimoTime Enterprises  All Rights Reserved
  Table of Contents Version 10.03.20 
  Introduction
 
  Programming Objectives
  Programming Input and Output
  Programming Requirements
  Programming Overview
  The Call Interface
  Sample CMD Members for Net Express
 
  CMD to Run the Demonstration Program
  CMD to Create a JUSTIFY Info File
  Sample JCL Members for OS/390 or Mainframe Express
 
  JCL to Run the Demonstration Program
  JCL to Create a RIGHTADJ Info File
  The Demonstration Program
  The Justify Text Routine (Center, Right or Left)
  Summary
 
  Software Agreement and Disclaimer
  Downloads and Links to Similar Pages
  Comments or Suggestions
  About SimoTime

Introduction
(Next) (Previous) (Table-of-Contents)

This suite of programs provides examples that will create, access and convert sequential files that use variable-length-records.

SEQUENTIAL,
Fixed-Record-Length
May be downloaded from the Mainframe using the "BINARY MODE" of File-Transfer-Protocol (FTP) and accessed in the Micro Focus environment with the CHARSET(EBCDIC) directive. Please note: the IBMCOMP and NOTRUNC directives may be required.
SEQUENTIAL,
Variable-Record-Length
May be downloaded from the Mainframe using the "BINARY MODE" of File-Transfer-Protocol (FTP) but must ne converted to a Micro Focus format for Variable-Record-Length to process in the Windows (or UNIX) environment. The CHARSET(EBCDIC) directive will be required. Please note: the IBMCOMP and NOTRUNC directives may be required.
INDEXED,
Variable-Record-Length
Must be copied to a SEQUENTIAL file format prior to downloading and recreated in the Windows (or UNIX) environment. The CHARSET(EBCDIC) directive will be required. Please note: the IBMCOMP and NOTRUNC directives may be required.

In the preceding table the use of the CHARSET(EBCDIC) directive with IBMCOMP and NOTRUNC directives are referenced as requirements. The scope of effort required to translate the records between EBCDIC and ASCII is directly proportional to the number and location of the Signed-Numeric, Packed and Binary fields. Additional complexities are introduced if "REDEFINES" and "OCCURS DEPENDING ON" capabilities are used. With the CHARSET(EBCDIC) directive it is not necessary to do ASCII/EBCDIC translation.

The source code for both COBOL programs is written using the VS COBOL II dialect and also work with COBOL for MVS and COBOL/370. A JCL member is provided to run the job as an MVS batch job on an IBM mainframe or as a project with Micro Focus Mainframe Express (MFE) running on a PC with Windows. A Windows Command (.CMD) file is provided to run the job on a PC with Micro Focus Net Express. This program may serve as a tutorial for new programmers and as a reference for experienced programmers. Additional information is provided in the Downloads and Links to Similar Pages section of this document.

Programming Objectives
(Next) (Previous) (Table-of-Contents)

The following is a list of the functions provided in this example.

1. Demonstrate how to read an ASCII/TEXT file and create a fixed-record-length, sequential file with EBCDIC data.
2. Demonstrate how to read the fixed-record-length, sequential file with EBCDIC data and create a variable-record-length, sequential file with EBCDIC data.
3. Demonstrate how to read the variable-record-length, sequential file with EBCDIC data and create a fixed-record-length, sequential file with EBCDIC data.
4. Demonstrate how to read the fixed-record-length, sequential file with EBCDIC data and create an ASCII/TEXT file.
5. Demonstrate how to compare the contents of two data files.

The first task performed by the SimoJUST routine is to scan the source field from left to right and determine the first and last non-space character and the length of the test string within the source field. The next task is to do the requested justification (center, right or left) by copying the text string from the source field to the appropriate position in target field. IF a request other than CENTER, RIGHT or LEFT is requested the return code (or JUST-RESPOND) is set to 0008.

Programming Input and Output
(Next) (Previous) (Table-of-Contents)

The following is an example of the contents of the input or JUSTIFY-info file (JUSTGET1).

The following is an example of the output file (JUSTPUT1) based on the preceding JUSTIFY-info file.

Programming Requirements
(Next) (Previous) (Table-of-Contents)

This suite of samples programs will run on the following platforms.

1. Executes on Windows/2000, Windows/NT and Windows/XP using Micro Focus Net Express and the CMD file provided.
2. May be ported to run on the UNIX platforms supported by Micro Focus COBOL.
3. Executes on a mainframe with MVS or Windows/2000, Windows/NT and Windows/XP using Micro Focus Mainframe Express and the JCL file provided.

Programming Overview
(Next) (Previous) (Table-of-Contents)

The following diagram is an overview of how the demonstration program fits into the example. The demonstration program will read the JUSTIFY info file (JUSTGET1), call the right-adjust routine and write the results to the output file (JUSTPUT1). The BLUE boxes are unique to the mainframe and Micro Focus Mainframe Express. The RED boxes are unique to the PC with Windows and Micro Focus Net Express. The GREEN boxes are platform independent and will execute on the mainframe or a PC with Windows. Also, the GREEN boxes may be ported to a UNIX platform that is supported by Micro Focus COBOL.

             
   
CrtVlrE1
cmd
      Start the jVariable-Length-Record creation and conversion process.
   
 
       
TxaDbV01
text
     
     
     
CBLVLRC1
cobol
     
     
     
SqeDbF01
qsam
  Read ASCII/Text and create a Sequential, EBCDIC file.
   
 
       
SqeDbF01
qsam
     
     
     
CBLVLRC2
cobol
     
     
     
SIMOBSIO
cobol
  Read Sequential, write Mainframe Variable using BSIO.
   
 
 
 
   
   
 
 
FteDbV01
qsam
   
   
 
       
SIMOBSIO
cobol
     
     
     
CBLVLRC3
cobol
     
     
     
VreDbV01
qsam
  Read Mainframe Sequential-Variable using BSIO, create Micro Focus Sequential-Variable . 
 
 
 
       
FteDbV01
qsam
 
 
       
   
 
       
VreDbV01
qsam
     
     
     
CBLVLRC4
cobol
     
     
     
SIMOBSIO
cobol
  Read Micro Focus Sequential-Variable , create Mainframe Sequential-Variable using BSIO.
   
 
 
 
   
   
 
 
FteDbV02
qsam
  The FteDbV02 should be the same as FteDbV01 that was created in a preceding step.
   
 
       
SIMOBSIO
cobol
     
     
     
CBLVLRC5
cobol
     
     
     
SqeDbF01
qsam
  Read Mainframe Variable using BSIO, write Sequential Fixed.
 
 
 
       
FteDbV02
qsam
 
 
       
   
 
       
SqeDbF01
qsam
     
     
     
CBLVLRC6
cobol
     
     
     
TxaDbV02
text
  Read Sequential Fixed, write ASCII/Text.
   
 
       
   
EOJ
      End-of-Job
             

The Call Interface
(Next) (Previous) (Table-of-Contents)

The following is the syntax for calling the right-adjust routine (SIMOJUST.CBL).

        call 'SIMOJUST' using JUST-PASS-AREA

The callable justify routine will accept a string of text up to forty-eight (48) characters. A data structure for calling the SIMOJUST routine is provided. A copy file (PASSJUST.CPY) is provided with the following fields defined.

      *****************************************************************
      *     Data Structure or Pass Area used for calling SIMOJUST.    *
      *****************************************************************
      *         Copyright (C) 1987-2010 SimoTime Enterprises          *
      *                     All Rights Reserved                       *
      *****************************************************************
      *              Provided by SimoTime Enterprises                 *
      *        Our e-mail address is: helpdesk@simotime.com           *
      *     Also, visit our Web Site at http://www.simotime.com       *
      *****************************************************************
       01  JUST-PASS-AREA.
           05  JUST-REQUEST    PIC X(8).
           05  JUST-RESPOND    PIC 9(4).
           05  JUST-SOURCE     PIC X(60).
           05  JUST-TARGET     PIC X(60).
      *!   PASSJUST - End-of-Copy File...

The following table is an overview of the data strings used in the pass area.

JUST-REQUEST This is an eight character data string and should contain the following in upper case.
CENTER This keyword causes the justify routine (SIMOJUST) to center the text string into the specified field (JUST-TARGET).
RIGHT This keyword causes the justify routine (SIMOJUST) to right-adjust the text string into the specified field (JUST-TARGET).
LEFT This keyword causes the justify routine (SIMOJUST) to left-adjust the text string into the specified field (JUST-TARGET).
The calling program must provide one of the above as a request. Otherwise, a non-zero return code will be set in the following result field. This data string is not changed by the justify routine.
JUST-RESPOND This is a four byte binary data string and is used by the conversion routine to pass a return code. If the conversion request is successful the value in this data string will be zero.
JUST-SOURCE This is the sixty (60) byte input for the SimoJUST routine. It is not modified by the justify routine.
JUST-TARGET This is the sixty (60) byte output for the SimoJUST routine. The requested text string is copied to this field in a format that is centered, right-adjusted of left-adjusted based on the JUST-REQUEST.

Sample CMD File
(Next) (Previous) (Table-of-Contents)

This sample suite of programs has two CMD members. The first CMD member will execute the demonstration program. The second CMD member will create a JUSTIFY info file (JUSTGET1.TXT) that is used by the first CMD member as input.

Sample CMD, Run the Demonstration Program
(Next) (Previous) (Table-of-Contents)

The following is the CMD required to run the demonstration program on a Personal Computer with Micro Focus Net Express.

Sample CMD, Create a JUSTIFY Info File
(Next) (Previous) (Table-of-Contents)

The following is the CMD that may be used to create a JUSTIFY-Info file(JUSTGET1.TXT) .

Sample JCL
(Next) (Previous) (Table-of-Contents)

This sample suite of programs has two JCL members. The first JCL member will execute the demonstration program. The second JCL member will create a JUSTIFY info file (DSN=SIMOTIME.DATA.JUSTGET1) that is used by the first JCL member as input.

Sample JCL, Run the Demonstration Program
(Next) (Previous) (Table-of-Contents)

The following is the JCL required to run the demonstration program on the mainframe or with Micro Focus Mainframe Express.

Sample JCL, Create a Justify Info File
(Next) (Previous) (Table-of-Contents)

The following is the JCL that may be used to create a JUSTIFY-info file.

The Demonstration Program
(Next) (Previous) (Table-of-Contents)

The following is the source code listing for the demonstration program.

The JUSTIFY Routine
(Next) (Previous) (Table-of-Contents)

The following is the source code listing for the Centering, Right or Left Justify routine.

Summary
(Next) (Previous) (Table-of-Contents)

The purpose of this document is to assist as a tutorial for new programmers or as a quick reference for experienced programmers. This suite of programs provides an example of a routine that does centering and left or right justification of a text string within a field.

Software Agreement and Disclaimer
(Next) (Previous) (Table-of-Contents)

Permission to use, copy, modify and distribute this software for any non-commercial purpose and without fee is hereby granted, provided the SimoTime copyright notice appear on all copies of the software. The SimoTime name or Logo may not be used in any advertising or publicity pertaining to the use of the software without the written permission of SimoTime Enterprises.

Permission to use, copy, modify and distribute this software for any commercial purpose requires a fee to be paid to SimoTime Enterprises. Once the fee is received by SimoTime the latest version of the software will be delivered and a license will be granted for use within an enterprise, provided the SimoTime copyright notice appear on all copies of the software. The SimoTime name or Logo may not be used in any advertising or publicity pertaining to the use of the software without the written permission of SimoTime Enterprises.

SimoTime Enterprises makes no warranty or representations about the suitability of the software for any purpose. It is provided "AS IS" without any express or implied warranty, including the implied warranties of merchantability, fitness for a particular purpose and non-infringement. SimoTime Enterprises shall not be liable for any direct, indirect, special or consequential damages resulting from the loss of use, data or projects, whether in an action of contract or tort, arising out of or in connection with the use or performance of this software.

If you have any questions, suggestions or comments please call or send an e-mail to: helpdesk@simotime.com

Downloads and Links to Similar Pages
(Next) (Previous) (Table-of-Contents)

You may download this example at http://www.simotime.com/sim4dzip.htm#COBOLZipJustifyText or view the complete list of SimoTime Examples at http://www.simotime.com/sim4dzip.htm .

Note: You must be attached to the Internet to download a Z-Pack or view the list.

Check out   The COBOL Connection  in the SimoTime Library for more examples of mainframe COBOL techniques and sample code.

Check out   The JCL Connection  in the SimoTime Library for more mainframe JCL examples.

Check out   The SimoTime Library   for a wide range of topics for Programmers, Project Managers and Software Developers.

To review all the information available on the SimoTime Web Site start at   http://www.SimoTime.com  .

For more information about Micro Focus Mainframe Express refer to   http://www.microfocus.com  .

Comments or Suggestions
(Next) (Previous) (Table-of-Contents)

If you have any questions, suggestions or comments please call or send an e-mail to: helpdesk@simotime.com

About SimoTime Enterprises
(Next) (Previous) (Table-of-Contents)

Founded in 1987, SimoTime Enterprises is a privately owned company. We specialize in the creation and deployment of business applications using new or existing technologies and services. We have a team of individuals that understand the broad range of technologies being used in today's environments. This includes the smallest thin client using the Internet and the very large mainframe systems. There is more to making the Internet work for your company's business than just having a nice looking WEB site. It is about combining the latest technologies and existing technologies with practical business experience. It's about the business of doing business and looking good in the process. Quite often, to reach larger markets or provide a higher level of service to existing customers it requires the newer Internet technologies to work in a complementary manner with existing corporate mainframe systems. Whether you want to use the Internet to expand into new market segments or as a delivery vehicle for existing business functions simply give us a call or check the web site at http://www.simotime.com


Return-to-Top
Copyright © 1987-2012  SimoTime Enterprises  All Rights Reserved
When technology complements business
http://www.simotime.com