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. trunc()用法和add_months()

    TRUNC函数用于对值进行截断. 用法有两种:TRUNC(NUMBER)表示截断数字,TRUNC(date)表示截断日期. (1)截断数字: 格式:TRUNC(n1,n2),n1表示被截断的数字,n2 ...

  2. 爬虫模块之requests模块

    一 模块的下载安装 pip install requests 二 爬虫的介绍 什么是爬虫:就是模拟浏览器发送请求:保存到本地:提取有用的数据:保存到数据库 爬虫的价值:获取有用的数据,保存到数据库 爬 ...

  3. centos7 hbase 搭建笔记

    1.require:java环境,本地可用的hadoop 2.拷贝hbase文件(hive-1.2.6) 3.设置环境变量 export HBASE_HOME=/data/spark/bin/hbas ...

  4. 【转】Linux useradd

    Linux 系统是一个多用户多任务的分时操作系统,任何一个要使用系统资源的用户,都必须首先向系统管理员申请一个账号,然后以这个账号的身份进入系统.用户的账号一方面可以帮助系统管理员对使用系统的用户进行 ...

  5. poj-3928(树状数组)

    题目链接:传送门 题意:n个乒乓球运动员要互相练习,都去一个运动员那里比赛,举办训练的运动员不能水平最高或最低. 现在给出n个运动员的水平,求出最终有多少种组合. 思路:先对运动员进行离散化,然后进行 ...

  6. WebSocket的原理与优缺点

    websocket 是长连接,受网络限制比较大,需要处理好重连,比如用户进电梯或电信用户打个电话网断了,这时候就需要重连,如果 ws 一直重连不上,有些较复杂的业务方会不愿意的,是不是还要搞个 htt ...

  7. vue 开发系列(三) vue 组件开发

    概要 vue 的一个特点是进行组件开发,组件的优势是我们可以封装自己的控件,实现重用,比如我们在平台中封装了自己的附件控件,输入控件等. 组件的开发 在vue 中一个组件,就是一个独立的.vue 文件 ...

  8. SQL中的split方法的使用

    参数说明: 1.@String :需要split的字符串 2.@Delimiter :格式化时分隔符 3.@index :返回split后数组的值 ), ),)) ) AS BEGIN )) ) DE ...

  9. 整合Spring+Struts2+Mybatis加spring单元测试等

    前言 自己是在CentOS7的IntelliJ IDEA里开发的,里面中文输入法有问题经常用不了,所以这里用了很多chinglish,希望不要介意: 一:pom依赖 <?xml version= ...

  10. 微信小程序踩坑集合

    1:官方工具:https://mp.weixin.qq.com/debug/w ... tml?t=1476434678461 2:简易教程:https://mp.weixin.qq.com/debu ...