Right, Left or Center Justify
SimoJUST - The COBOL Source Code
  Table of Contents  v-16.01.01 - simojust.htm 
  Introduction
  SimoJUST, What It Does
  SimoJUST, How To Use
  The COBOL Source Code
  The COBOL Copy File
  Summary
  Software Agreement and Disclaimer
  Downloads and Links
  Current Server or Internet Access
  Internet Access Required
  Glossary of Terms
  Comments or Feedback
  Company Overview
The SimoTime Home Page 

Table of Contents Previous Section Next Section Introduction

The objective of the text justification routine is to create an alpha- numeric field that will contain a variable-length text string that is left-justified, centered or right-justified within a fixed-length field.

This document provides a listing of the COBOL source code for viewing. Additional information about this program may be obtained by sending an e-mail to: helpdesk@simotime.com


We have made a significant effort to ensure the documents and software technologies are correct and accurate. We reserve the right to make changes without notice at any time. The function delivered in this version is based upon the enhancement requests from a specific group of users. The intent is to provide changes as the need arises and in a timeframe that is dependent upon the availability of resources.

Copyright © 1987-2019
SimoTime Technologies and Services
All Rights Reserved

Table of Contents Previous Section Next Section SimoJUST, What It Does

The SimoJUST routine (or callable program) will justify (center, left or right) a text string within a field and insert the appropriate leading and/or trailing space characters. If the requirement is to right-adjust, zero-fill a numeric field that will contain all digits and be properly aligned to the units position then refer to the right-adjust, zero-fill routine (or simora12.htm) .

Table of Contents Previous Section Next Section SimoJUST, How To Use

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

        move 'CENTER  '     to JUST-REQUEST
move 'Text String ' to JUST-SOURCE
call 'SIMOJUST' using JUST-PASS-AREA.

The callable justify routine will accept a string of text up to sixty (60) characters. A Working Storage data structure for calling the SIMOJUST routine is required. A copy file (PASSJUST.cpy) is provided with the following fields defined.

      *****************************************************************
      *                PASSJUST is a COBOL Copy File                  *
      *     Data Structure or Pass Area used for calling SIMOJUST.    *
      *         Copyright (C) 1987-2019 SimoTime Technologies         *
      *                     All Rights Reserved                       *
      *****************************************************************
      *              Provided by SimoTime Technologies                *
      *        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 - - - - - - - - - - - PASSJUST *
      *****************************************************************
      *

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

Parameter Description
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).
RIGHTThis keyword causes the justify routine (SIMOJUST) to right-adjust the text string into the specified field (JUST-TARGET).
LEFTThis 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.
  Pass Area Structure for calling the SIMOJUST Routine

 

Table of Contents Previous Section Next Section The COBOL Source Code

The following member (SIMOJUST.cbl) is the COBOL Source Code.

       IDENTIFICATION DIVISION.
       PROGRAM-ID.    SIMOJUST.
       AUTHOR.        SIMOTIME TECHNOLOGIES.
      *****************************************************************
      * Copyright (C) 1987-2019 SimoTime Technologies.                *
      *                                                               *
      * All rights reserved.  Unpublished, all rights reserved under  *
      * copyright law and international treaty.  Use of a copyright   *
      * notice is precautionary only and does not imply publication   *
      * or disclosure.                                                *
      *                                                               *
      * 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    *
      * Technologies.                                                 *
      *                                                               *
      * Permission to use, copy, modify and distribute this software  *
      * for any commercial purpose requires a fee to be paid to       *
      * SimoTime Technologies. 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           *
      * Technologies.                                                 *
      *                                                               *
      * SimoTime Technologies makes no warranty or representations    *
      * about the suitability of the software for any purpose. It is  *
      * provided "AS IS" without any expressed or implied warranty,   *
      * including the implied warranties of merchantability, fitness  *
      * for a particular purpose and non-infringement. SimoTime       *
      * Technologies 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                                  *
      *                                                               *
      * SimoTime Technologies                                         *
      * 15 Carnoustie Drive                                           *
      * Novato, CA 94949-5849                                         *
      * 415.883.6565                                                  *
      *                                                               *
      * RESTRICTED RIGHTS LEGEND                                      *
      * Use, duplication, or disclosure by the Government is subject  *
      * to restrictions as set forth in subparagraph (c)(1)(ii) of    *
      * the Rights in Technical Data and Computer Software clause at  *
      * DFARS 52.227-7013 or subparagraphs (c)(1) and (2) of          *
      * Commercial  Computer Software - Restricted Rights  at 48      *
      * CFR 52.227-19, as applicable.  Contact SimoTime Technologies, *
      * 15 Carnoustie Drive, Novato, CA 94949-5849.                   *
      *                                                               *
      *****************************************************************
      *      This program is provided by SimoTime Technologies        *
      *        Our e-mail address is: helpdesk@simotime.com           *
      *     Also, visit our Web Site at http://www.simotime.com       *
      *                                                               *
      *****************************************************************
      *
      *****************************************************************
      * Source Member: SIMOJUST.CBL
      * Copy Files:    PASSJUST.CPY
      *****************************************************************
      *
      * SIMOJUST - Justify (or position) a text string within a field
      * based on the caller's request to center, left or right justify.
      *
      * EXECUTION or CALLING PROTOCOL
      * -----------------------------
      * CALL 'SIMOJUST' USING JUST-PASS-AREA.
      *
      *****************************************************************
      *
      * MAINTENANCE
      * -----------
      * 1988/02/27 Simmons, Created program.
      * 1988/02/27 Simmons, No changes to date.
      *
      *****************************************************************
      *
       DATA DIVISION.
       WORKING-STORAGE SECTION.
       01  Z-PTR-1             pic 9(3)    value 0.
       01  Z-PTR-2             pic 9(3)    value 0.
       01  Z-MAX-1             pic 9(3)    value 0.
       01  Z-MAX-2             pic 9(3)    value 0.
       01  FIRST-BYTE          pic 9(3)    value 0.
       01  FINAL-BYTE          pic 9(3)    value 0.
       01  LENGTH-OF-STRING    pic 9(3)    value 0.

      *****************************************************************
       LINKAGE SECTION.
       COPY PASSJUST.

      *****************************************************************
       PROCEDURE DIVISION using JUST-PASS-AREA.
           perform INITIALIZE-FIELDS

           perform until Z-PTR-1 > Z-MAX-1
               if  JUST-SOURCE(Z-PTR-1:1) not = SPACE
                   if  FIRST-BYTE = 0
                       add Z-PTR-1 to ZERO giving FIRST-BYTE
                   end-if
                   add Z-PTR-1 to ZERO giving FINAL-BYTE
               end-if
               add 1 to Z-PTR-1
           end-perform

           compute LENGTH-OF-STRING = FINAL-BYTE - FIRST-BYTE + 1

           evaluate JUST-REQUEST
             when 'CENTER  ' perform REQUEST-CENTER
             when 'LEFT    ' perform REQUEST-LEFT
             when 'RIGHT   ' perform REQUEST-RIGHT
             when other      add 8 to ZERO giving JUST-RESPOND
           end-evaluate

           GOBACK.

      *****************************************************************
       INITIALIZE-FIELDS.
           add 16 to ZERO giving JUST-RESPOND
           move ZERO to Z-PTR-1
           move ZERO to Z-PTR-2
           move ZERO to FIRST-BYTE
           move ZERO to FINAL-BYTE
           move ZERO to LENGTH-OF-STRING
           move SPACES to JUST-TARGET
           add length of JUST-SOURCE to ZERO giving Z-MAX-1
           add length of JUST-TARGET to ZERO giving Z-MAX-2
           exit.

      *****************************************************************
       REQUEST-CENTER.
           compute Z-PTR-2 = (Z-MAX-2 - LENGTH-OF-STRING) / 2 + 1
           move JUST-SOURCE(FIRST-BYTE:LENGTH-OF-STRING)
             to JUST-TARGET(Z-PTR-2:LENGTH-OF-STRING)
           move ZERO to JUST-RESPOND
           exit.

      *****************************************************************
       REQUEST-LEFT.
           add 1 to ZERO giving Z-PTR-2
           move JUST-SOURCE(FIRST-BYTE:LENGTH-OF-STRING)
             to JUST-TARGET(Z-PTR-2:LENGTH-OF-STRING)
           move ZERO to JUST-RESPOND
           exit.

      *****************************************************************
       REQUEST-RIGHT.
           compute Z-PTR-2 = (Z-MAX-2 - LENGTH-OF-STRING) + 1
           move JUST-SOURCE(FIRST-BYTE:LENGTH-OF-STRING)
             to JUST-TARGET( Z-PTR-2:LENGTH-OF-STRING)
           move ZERO to JUST-RESPOND
           exit.
      *****************************************************************
      *      This example is provided by SimoTime Technologies        *
      *        Our e-mail address is: helpdesk@simotime.com           *
      *     Also, visit our Web Site at http://www.simotime.com       *
      *****************************************************************

Table of Contents Previous Section Next Section The COBOL Copy File

The following member (PASSJUST.cpy) is the COBOL copy file that may be used when calling SimoJUST.

      *****************************************************************
      *                PASSJUST is a COBOL Copy File                  *
      *     Data Structure or Pass Area used for calling SIMOJUST.    *
      *         Copyright (C) 1987-2019 SimoTime Technologies         *
      *                     All Rights Reserved                       *
      *****************************************************************
      *              Provided by SimoTime Technologies                *
      *        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 - - - - - - - - - - - PASSJUST *
      *****************************************************************
      *

Table of Contents Previous Section Next Section Summary

The objective of the text justification routine is to create an alpha- numeric field that will contain a variable-length text string that is left-justified, centered or right-justified within a fixed-length field. This document may be used to assist as a tutorial for new programmers or as a quick reference for experienced programmers.

In the world of programming there are many ways to solve a problem. This document and the links to other documents are intended to provide a greater awareness of the Data Management and Application Processing alternatives.

The documentation and software were developed and tested on systems that are configured for a SIMOTIME environment based on the hardware, operating systems, user requirements and security requirements. Therefore, adjustments may be needed to execute the jobs and programs when transferred to a system of a different architecture or configuration.

SIMOTIME Services has experience in moving or sharing data or application processing across a variety of systems. For additional information about SIMOTIME Services or Technologies please send an e-mail to: helpdesk@simotime.com or call 415 883-6565. We appreciate hearing from you.

Table of Contents Previous Section Next Section Software Agreement and Disclaimer

Permission to use, copy, modify and distribute this software, documentation or training material for any purpose requires a fee to be paid to SimoTime Technologies. Once the fee is received by SimoTime the latest version of the software, documentation or training material 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 Technologies.

SimoTime Technologies makes no warranty or representations about the suitability of the software, documentation or learning material for any purpose. It is provided "AS IS" without any expressed or implied warranty, including the implied warranties of merchantability, fitness for a particular purpose and non-infringement. SimoTime Technologies 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, documentation or training material.

Table of Contents Previous Section Next Section Downloads and Links

This section includes links to documents with additional information that are beyond the scope and purpose of this document. The first group of documents may be available from a local system or via an internet connection, the second group of documents will require an internet connection.

Note: A SimoTime License is required for the items to be made available on a local system or server.

Table of Contents Previous Section Next Section Current Server or Internet Access

The following links may be to the current server or to the Internet.

Note: The latest versions of the SimoTime Documents and Program Suites are available on the Internet and may be accessed using the Link to Internet icon. If a user has a SimoTime Enterprise License the Documents and Program Suites may be available on a local server and accessed using the Link to Server icon.

Link to Internet   Link to Server   Explore How to Center, Left or Right Justify a text string within a field using a COBOL program. This suite of programs includes Job Scripts to create test data and execute the COBOL programs. The Job Scripts include JCL Members for an IBM Mainframe System, CMD Files for a Windows System and Bash Script Files for a Linux or UNIX System.

Link to Internet   Link to Server   Explore a complete list of the SimoTime Callable Routines or Utility Programs. This includes the callable routines and utility programs for the Micro Focus environment.

Link to Internet   Link to Server   Explore an Extended List of Software Technologies that are available for review and evaluation. The software technologies (or Z-Packs) provide individual programming examples, documentation and test data files in a single package. The Z-Packs are usually in zip format to reduce the amount of time to download.

Link to Internet   Link to Server   Explore The ASCII and EBCDIC Translation Tables. These tables are provided for individuals that need to better understand the bit structures and differences of the encoding formats.

Link to Internet   Link to Server   Explore The File Status Return Codes to interpret the results of accessing VSAM data sets and/or QSAM files.

Table of Contents Previous Section Next Section Internet Access Required

The following links will require an internet connect.

This suite of programs and documentation is available to download for review and evaluation purposes. Other uses will require a SimoTime Software License. Link to an Evaluation zPAK Option that includes the program members, documentation and control files.

A good place to start is The SimoTime Home Page for access to white papers, program examples and product information. This link requires an Internet Connection

Explore The Micro Focus Web Site for more information about products and services available from Micro Focus. This link requires an Internet Connection.

Table of Contents Previous Section Next Section Glossary of Terms

Link to Internet   Link to Server   Explore the Glossary of Terms for a list of terms and definitions used in this suite of documents and white papers.

Table of Contents Previous Section Next Section Comments or Feedback

This document was created and is copyrighted and maintained by SimoTime Technologies.

If you have any questions, suggestions, comments or feedback please call at 1 415 827-7045 or send an e-mail to: helpdesk@simotime.com

We appreciate hearing from you.

Table of Contents Previous Section Next Section Company Overview

SimoTime Technologies was founded in 1987 and 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. Our customers include small businesses using Internet technologies to corporations using very large mainframe systems.

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. We specialize in preparing applications and the associated data that are currently residing on a single platform to be distributed across a variety of platforms.

Preparing the application programs will require the transfer of source members that will be compiled and deployed on the target platform.

The data will need to be transferred between the systems and may need to be converted and validated at various stages within the process.

SimoTime has the technology, services and experience to assist in the application and data management tasks involved with doing business in a multi-system environment.

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 at 1 415 827-7045 or send an e-mail to: helpdesk@simotime.com

Also, check the web site at http://www.simotime.com


Return-to-Top
Text Justification using COBOL
Copyright © 1987-2019
SimoTime Technologies and Services
All Rights Reserved
When technology complements business
http://www.simotime.com