ENVIRONMENT DIVISION.

CONFIGURATION SECTION.SOURCE-COMPUTER. IBM-AS400.
OBJECT-COMPUTER. IBM-AS400.

这个没什么说的。

Data Division : Working Storage

· Use the prefix WSAA- for fields for any user defined working variables. You should group
together data which forms a logical group, e.g. subscripts.

使用WSAA-作为用户定义字段前缀;

· Use asterisks (*) to separate logical groups of data and to make the working storage easier
to browse.

使用星号*分隔数据逻辑组,使代码易读;

· Two fields must be set up at the beginning of working storage containing the program name
and its version number. Whenever the program is totally revised, the version number is
incremented by 1.
01 WSAA-PROG PIC X(05) VALUE(annnn).
01 WSAA-VERSION PIC X(02) VALUE(nn).

在working storage开头必须定义两个字段:程序名称和版本号,每次修改版本号增加1;

· All files which are used by the program, including subsystem specific logical files, must be
defined under an 01 level of:
01 FORMATS.
   03 aaaaREC PIC X(10) VALUE ('aaaaREC').
 03 bbbbbbbREC PIC X(10) VALUE ('bbbbbbbREC').

所有用到的逻辑文件(LF文件、子系统、表),都定义在01级;

· All tables used by the program must be defined under an 01 level of:
01 TABLES.
   03 Tnnnn PIC X(05) VALUE ('Tnnnn').
所有的表也定义在01级,表也要在01 FORMATS.定义,格式是:TnnnnREC

例子:

01  FORMATS.
           03  BMSGREC                 PIC X(10) VALUE 'BMSGREC'.
           03  BPRDREC                 PIC X(10) VALUE 'BPRDREC'.
           03  BSPRREC                 PIC X(10) VALUE 'BSPRREC'.
           03  BSSCREC                 PIC X(10) VALUE 'BSSCREC'.
           03  BUPAREC                 PIC X(10) VALUE 'BUPAREC'.
           03  DESCREC                 PIC X(10) VALUE 'DESCREC'.
           03  AE52DATREC              PIC X(10) VALUE 'AE52DATREC'.
           03  GR04DATREC              PIC X(10) VALUE 'GR04DATREC'.
           03  AA01REC                 PIC X(10) VALUE 'AA01REC'.
           03  ITEMREC                 PIC X(10) VALUE 'ITEMREC'.
           03  TT832REC                PIC X(10) VALUE 'TT832REC'.

· All errors used by the program must be defined under an 01 level of:
01 ERRORS.
  03 annn PIC X(04) VALUE ('annn').

错误必须定义在01级。

· All PICs must start in column 40.

PIC必须起始在40列;

· Always use indentation and line up the levels. Ideally, 4 characters of indentation should be
used:
01 WSAA-GROUP-NAME
    03 WSAA-DATA-NAME-1
    03 WSAA-SUB-GROUP-NAME
        05 WSAA-DATA-NAME-2

一般使用4个字符的缩进;

Procedure Division

· Each section must begin on a new page.

所有的节必须开始在新页;

· All sections must be prefixed by a number. These should be incremented sequentially to
simplify locating them within the program.

所有的节开始于一个递增的数字前缀;

· Paragraphs within a section should all increment from the section header number in steps of
at least 10.

数字前缀至少递增10,比如1000-INITIALISE,后面的第一个节必须是1010-,第二个是1020-,也可以跳增,比如第二个也可以1080-;

· Section headers should be underlined by a row of asterisks (*). Above each section there
must be a brief description of the functions, enclosed in asterisks.
· Asterisks (to indicate comment lines) must be used to separate logical blocks of statements
and to improve readability.

使用星号*分隔块;

· Use 4 characters of indentation for IF, PERFORM statements etc.

IF、PERFORM也是4个字符缩进;

· Always complete IF, PERFORM statements with END-IF, END-PERFORM etc.
· All statements must have their right hand portion aligned to column 48.

所有的声明,必须在右侧对齐于48列,包括了TO,=, USING, OF......

· The exit paragraph for each section will be called nnnn-EXIT, where n has the same first
digit as the section header.

退出段以nnnn-EXIT定义,其中nnnn是起始数字;

· All CALLs to subroutines and subprograms must be explicit, not dynamic, i.e. a working
storage variable should NOT be used to hold the name of the subroutine / program to be
called. The only exception to this is for table driven subroutine calls.

不能使用子程序的变量名称定义;

· STOP RUN must not be used.

不能使用STOP RUN;

· On-line mainline programs should never explicitly issue an EXIT PROGRAM, but should
allow MAINF/MAING to do this.
· For on-line screen programs, the procedure division will be using two linkage areas, both in
copybooks. The first area is WSSPCOMN and the second depends on the area you are
working in, as follows:

  • SMART - WSSPSMART
  • LIFE - WSSPLIFE
  • POLISY - WSSPFANG
  • FSU - WSSPFSU
  • Window Program - WSSPWINDOW

· The GO TO command should only be used with a very good reason. Its use should be
restricted to jumping past a block of code that is not required, and even then it is preferable
to PERFORM a section instead.

谨慎使用GO TO;

· When validating an item against a table, read the ITEM or the ITDM file first and then the
DESC file if you want the description. The DESC file is read using a specific language
code, and if the description is not present in the language of operation, it will appear that
the item does not exist.

当验证一个表对应的一个项,先读ITDM或ITDM文件,如果需要描述说明则读DESC描述文件。

读DESC文件使用特定的语言代码,如果描述不存在于操作语言中,它会提示该项目不存在;

· Use the literal from working storage instead of a character string for such things as MRNF,
READR, T1690 in the procedure division, i.e.

使用原词而不是引用字符定义MRNF, READR, T1690之类的东西;

  • MOVE T1690 TO... 正确
  • MOVE ‘T1690’ TO...错误
  • MOVE READR  TO AA01-FUNCTION... 正确
  • MOVE ‘READR’  TO AA01-FUNCTION... 错误

· When setting up a key comprised of multiple fields, set the fields up in the order that they
appear in the key, since this is easier to read and to check.

· After all I/O calls, check for the abend conditions first.

在I/O调用之后,首先要检查退出条件(非常重要);

· If there is an abend condition, move the PARAMS to SYSR-PARAMS as well as the
STATUZ to SYSR-STATUZ.

在退出条件内部,以下两项需要赋值,SYSR-STATUZ、SYSR-PARAMS :

IF AE52DAT-STATUZ        NOT = O-K AND ENDP

  • MOVE AE52DAT-STATUZ      TO SYSR-STATUZ
  • MOVE AE52DAT-PARAMS      TO SYSR-PARAMS
  • PERFORM 600-FATAL-ERROR

END-IF.

· All subroutines should be called with a FUNCTION. The subroutine should check that the
function passed is held in its working storage, and, if it is not, should return a status of
FUNC to the calling program.
· All subroutines should pass back a STATUZ to the calling program. This should always be
'****' if the subroutine did not encounter an error condition. The calling program must
always check for a STATUZ of O-K on return from the call. A returned STATUZ other
than O-K is passed to SYSR-STATUZ and the abort processing is performed, or the
returned STATUZ is placed in the XXXX-ERR field as an error code.

Batch Program Sections Standards

All batch programs must include a copybook called MAINB as the first statement of the
procedure division. This copybook controls the overall logic flow of the program and will
perform the following, if required:
· Open, update and close a batch audit group during processing
· Remove all softlocks except those with an error status or held status
· Maintain a count of all records read, records not processed and records in error
· Restarting logic.
MAINB performs the following sections in the appropriate place:
0900-RESTART
Please refer to the Restart Logic section below.
1000-INITIALISE

  • Read any tables etc. applicable to the whole process,
  • Open files, set up report headings,
  • OPEN SQL cursors, etc.
  • Test for valid restart method 1 (re-run), 2 (continue) or 3 (skip completed cycles).

2000-PRIMARY-READ

  • Read primary file record
  • Call I/O module
  • SQL FETCH
  • COBOL READ etc.)
  • At end, set WSSP-EDTERROR to ENDP.

2500-EDIT

  • If applicable, perform any checking/validation to ensure the record read really requires
  • if not required, set WSSP-EDTERROR to spaces, (验证不需要的记录)
  • if error, move an error code to WSSP-EDTERROR,(错误发生)
  • else move OK to WSSP-EDTERROR.(验证正确的数据)
  • IF WSSP-EDTERROR = O-K Soft lock the entity, if applicable. (如果需要修改记录,则Soft lock)
  • If entity already locked, move spaces to WSSP-EDTERROR.(如果已上锁)

3000-UPDATE
Perform all the processing related to the primary record read, writing of details to a report etc.

执行所有与主记录相关的处理

3500-COMMIT
Please refer to the Restart Logic section below.
3600-ROLLBACK

Batch Program Development Checklist

Listed below is a summary of the steps required when building and maintaining batchprograms. Before starting, ensure that you have the following:
· The design of any reports required.
· The new subsystem specification or updated current manual.
To develop a new program or modify an existing one:
1. Build any new data sets required and modify any existing ones if required (CB ... *PF).
2. Generate any new or modified access methods required and their I/O modules (CB ... *LF).
3. If required, generate a new, or modify the existing, parameter prompt program (CB ...
*PARM).
4. Build or modify any printer files required (ED and CB ... *PRTF).
5. Create or modify the Batch Cobol program (ED Bnnnn). The standard batch skeleton
*CBL in PAXUS/XGENSKEL is for a report program.
6. For a new program, add the coding required in the standard section (ED ...).
7. Compile the program (CB ... *CBL).
8. If a CL program is required, for new programs, copy the standard CL skeleton program in
PAXUS/XGENSKEL (ED Cnnnn *CLP).
9. Compile the CL program (CB ... *CLP).
10.Ensure that the batch schedule details, batch extract details (T1697), control total details
(T1671) and reconciliation rules (T1672) are set up as required.
11.Test the programs.
While testing the program, you should ensure that:
1. All standards have been adhered to, especially that all error numbers, tables, record formats,
etc. are included in the appropriate places in working storage. (This information is required
by the Data Dictionary).
2. All control totals are accumulated correctly.
3. The program will run successfully even if the primary input file is empty or no processing is
required.
4. All database maintenance is performed correctly, including updates to the schedule
submissions file.
5. The program successfully traps any database or system errors which could occur.
6. The program will restart correctly if it is cancelled prior to successful completion.
7. On completion of a new mainline program, the program is registered to the correct
subsystem in the Data Dictionary.

Restart Logic

Smart/400开发上手5: Cobol开发标准的更多相关文章

  1. Smart/400开发上手2: COBOL批处理程序处理过程

    开发目的:1.建立DB2数据库表:2.建立逻辑视图:3.通过Cobol程序将一个源数据表的数据通过一定公式计算后导出到另一个目的数据库表源数据表:TIM3PF目的数据表:TIM4PF4.在AS400中 ...

  2. Smart/400开发上手1:入门

    1.介绍 Smart/400是在AS/400之上的开发平台,管理开发.运维的全生命周期. 2.设计基础 Introducing Fields Smart通过字段字典Field Dictionary来存 ...

  3. Smart/400开发上手3: 练习实践

    练习题 在2006年1月1日之前入职且在职的营销员,给予年资补贴2000元: 符合以上条件的,再按以下标准一次性发放职级补贴: 职级代码 简称 补偿金额 A1 AD 6000 B1 SBM 5000 ...

  4. Boost程序库完全开发指南——深入C++“准”标准库(第3版)

    内容简介  · · · · · · Boost 是一个功能强大.构造精巧.跨平台.开源并且完全免费的C++程序库,有着“C++‘准’标准库”的美誉. Boost 由C++标准委员会部分成员所设立的Bo ...

  5. HTML5 HybridApp开发上手指引

    眼下我们项目是基于AngularJS和ionic框架开发的Hybrid App.支持android phone/pad, iPhone,iPad四个平台版本号.以及微信版. 由于使用的技术有点新,所以 ...

  6. 微信小程序快速开发上手

    微信小程序快速开发上手 介绍: 从实战开发角度,完整系统地介绍了小程序的开发环境.小程序的结构.小程序的组件与小程序的API,并提供了多个开发实例帮助读者快速掌握小程序的开发技能,并能自己动手开发出小 ...

  7. C#中??和?分别是什么意思? 在ASP.NET开发中一些单词的标准缩写 C#SESSION丢失问题的解决办法 在C#中INTERFACE与ABSTRACT CLASS的区别 SQL命令语句小技巧 JQUERY判断CHECKBOX是否选中三种方法 JS中!=、==、!==、===的用法和区别 在对象比较中,对象相等和对象一致分别指的是什么?

    C#中??和?分别是什么意思? 在C#中??和?分别是什么意思? 1. 可空类型修饰符(?):引用类型可以使用空引用表示一个不存在的值,而值类型通常不能表示为空.例如:string str=null; ...

  8. 移动前端开发和 Web 前端开发的区别

    http://www.itcast.cn/news/20180125/16033584753.shtml 1,普通PC端开发与移动端开发区别. 先说背景,我大言不惭的说一下,我pc端的前端开发干了有快 ...

  9. Xamarin Anroid开发教程之Anroid开发工具及应用介绍

    Xamarin Anroid开发教程之Anroid开发工具及应用介绍 Xamarin开发Anroid应用介绍 如今智能手机已经盛行了好几年,而针对这些智能手机的软件开发也变得异常火热.但是在Andro ...

随机推荐

  1. 2018.11.02 洛谷P2831 愤怒的小鸟(状压dp)

    传送门 状压一眼题. 直接f[i]f[i]f[i]表示未选择状态为iii时的最小次数. 然后考虑现在怎么转移. 显然可以直接枚举消掉某一个点或者某两个点,复杂度O(n22n)O(n^22^n)O(n2 ...

  2. 新加了一块硬盘,在bios中可以看的到,在系统的磁盘管理器中看不到新加硬盘

    今天新加了一块硬盘,进入bios中可以看到新加的硬盘,但是进入系统后在磁盘管理及磁盘驱动器中都看不到.并且在设备管理器下其他设备出现了ATA channel1,前面显示感叹号,如下图所示: 而且电脑变 ...

  3. excel怎样添加的选项卡中含有下拉列表

    <customUI xmlns="http://schemas.microsoft.com/office/2006/01/customui"> <ribbon s ...

  4. ACtiveMQ中间件-发布订阅模式

    前言:ActiveMQ学习心得 1.MQ是什么 MQ全称为Message Queue, 消息队列(MQ)是一种应用程序对应用程序的通信方法.应用程序通过读写出入队列的消息(针对应用程序的数据)来通信, ...

  5. WORD文档中插入页码的问题

    原文链接:http://www.360doc.com/content/11/0216/15/849254_93539436.shtml 一.页码从第二页开始1.选择“插入-页码”,打开“页码”对话框. ...

  6. Codeforces Round #535 (Div. 3) 1108C - Nice Garland

    #include <bits/stdc++.h> using namespace std; int main() { #ifdef _DEBUG freopen("input.t ...

  7. android 按照拼音模糊查询中如何把字符转换成拼音

    http://files.cnblogs.com/liaolandemengxiang/%E6%96%B0%E5%BB%BA%E6%96%87%E4%BB%B6%E5%A4%B9.rar 首先转换成的 ...

  8. 《计算机科学基础》学习笔记_Part 1 Computer and Data

    Technorati Tags: 计算机科学基础,读书笔记 Chapter 1. Introduction Ø  计算机:黑盒,Output Data=f(Input Data, Program) Ø ...

  9. NoSQL数据库的分布式算法

    本文译自 Distributed Algorithms in NoSQL Databases 系统的可扩展性是推动NoSQL运动发展的的主要理由,包含了分布式系统协调,故障转移,资源管理和许多其他特性 ...

  10. 二分图学习——基础dfs判断二分图

    #include <iostream> #include <cstdio> #include <string.h> #include <vector> ...