zoukankan      html  css  js  c++  java
  • Smart/400开发上手1:入门

    1.介绍

    Smart/400是在AS/400之上的开发平台,管理开发、运维的全生命周期。

    2.设计基础

    Introducing Fields

    Smart通过字段字典Field Dictionary来存储Field,所有的字段都存在这个大字典里,为了方便Cobol程序的调用,必须事先定义Field。

    注意事项:

    • 不要删除字段
    • 字段后缀不能是数字,某些数字结尾的字段是系统定义字段
    • 开发新程序不一定要新建字段,因为已有程序很可能早已定义好了
    • 不超过8个字符

    字段类型. Valid values are:
    A - Alphanumeric
    C - Currency and monetary amount
    D - Date
    E - Currency amount
    M - Monetary
    N - Unsigned numeric
    S - Signed numeric
    T - Time
    V - Variable length
    Z - Date/Time stamp

    实用快速搜索field的小技巧:

    • 使用 “?ACC” 来模糊定位所有以ACC开头的字段;
    • 在HELP系统也可以查询字段;

    Using a Table or Data Set to Hold Data

    使用表格和数据集存储数据

    • 表是用来包含引用或“规则”信息的。该信息是静态的。在表项上有最小的验证,比如公司代码是一个典型的表项目。
    • 数据集用来处理业务功能数据,特性是不断变化的数据。

    可以把数据集看成物理文件Physical File。

    在设计完Data Sets后,需要编译。

    Compiling the Physical File

    编译物理文件

    编译物理文件的目的是使400系统感知Data Sets的更改,这么说可能比较形象,就是有点类似从源代码java文件转换为class文件。

    命令 : CB xxxxpf pf

    如果您修改了现有的数据集,则将:

    • 删除使用数据集的所有逻辑文件LF(LF逻辑文件可以认为是视图文件,是和Cobol沟通的文件)
    • 建立新版本的数据集
    • 将旧数据集的数据复制到新的字段
    • 删除旧的数据集
    • 重建以前已删除的逻辑文件LF

    逻辑文件

    LF逻辑文件可以认为是视图文件

    Select/Omit Specification

    Test的项:

    • EQ Equal
    • NE Not equal
    • GT Greater than
    • LT Less than
    • GE Greater than or equal to
    • LE Less than or equal to
    • RG Range
    • VAL Absolute value

    Logical View Database Files:

    • DTVHPF Logical View Header
    • DTVFPF Logical View Fields
    • DTVRPF Logical View Record Format (multi-format)
    • DTVIPF Logical View Key Fields
    • DTVSPF Logical View Select/Omit
    • DTVJPF Logical View Join Details

    编译逻辑文件

    Compiling the Logical File:  CB XXXX *LF

    编译后:

    • The Logical file DDS source is generated and placed in the XXXXXXGEN library, where XXXXXX is the development environment level identifier. This source is
      deleted when the logical file is PROMOTEd or deleted using the DLTOBJLVL/DLTOBJREL command.Each logical file has two separate open data paths (ODPs): read and update. A third open data path accommodates direct access. Each open data path makes available a file area through which the data is transferred, and a file pointer.
    • · The I/O module XXXXIO, where XXXX is the name of the logical file. A Cobol program which interfaces between the data set and the application program. The
      application program calls the I/O module each time access to data is required.
    • · Copybooks XXXXSKM and XXXXKEY, where XXXX is the name of the logical file. These two copybooks are used to ensure the correct format of the file is accessed in the application programs. The Schema copybook holds the parameters required to call the I/O module, and is copied into the working storage of the application program.The Key copybook contains the key fields only and is available to be used in working storage in application programs, i.e. if you are saving a key, use this copybook, thereby ensuring that, if the key changes, the correct version of it will be picked up by the Cobol program. The copybooks are placed in XXXXXXCPY/QLBLSRC (where XXXXXX is the development environment level id).

     在线程序开发

    Coding an On-line Program

    标准程序(Non Client/Server)

    标准程序做的事情:

    • 检索数据库信息和屏幕上显示的信息
    • 从屏幕上输出。
    • 验证在屏幕上输入的信息,并显示错误。
    • 输入,并更新数据库。
    • 显示下一个屏幕。

    需要的区域:

    • 1000-INITIALISE
    • 2000-SCREEN-EDIT
    • 3000-UPDATE
    • 4000-WHERE-NEXT

    包含:

    • Working Storage:

    VARCOM - common variables 通用变量
    SYSERRREC - record layout for system errors 系统错误的记录布局

    • Linkage Section:

    WSSPCOMN - linkage area to be passed between each mainline program
    WSSPxxxxx - linkage area used for all 'xxxxx' programs (for example,'xxxxx' may
    be WINDOW)
    SCRNPARAMS - screen parameters record

    • Procedure Division:

    MAINF - main controlling logic 主要的控制逻辑

     

    The 1000 Section

    • 初始化变量
    • 控制屏幕输出
    • 通常情况下,涉及到数字域和日期域初始化
    • 读取数据库,并将其移动到屏幕连接区域

    The 2000 Section

    • 2000节将执行到一个标志位:WSSP-EDTERROR is O-K(O-K是所有程序中定义的标准变量)
    • MAINF sets the SCRN-FUNCTION to INIT or NORML. INIT writes the screen without PUTOVR; NORML writes it with
      PUTOVR.
    • YOU MUST NEVER OVERRIDE THE SCREEN FUNCTION SET BY MAINF, UNLESS IT IS TO WRITE THE SCREEN FULLY PROTECTED
    • 在屏幕上书写,标准节200-SCREEN-ERRORS必须执行。执行语句必须是在调用后立即的下一个语句屏幕I / O模块。本节用于捕获屏幕错误。

    一个例子

    CALL 'SxxxxIO' USING SCRN-SCREEN-PARAMS
    Sxxxx-DATA-AREA.
    PERFORM 200-SCREEN-ERRORS.

    执行到这里,WSSP-EDTERROR 标志位被设置为 O-K

    The 3000 Section

    MAINF一旦检测到WSSP-EDTERROR 是 O-K,,它将执行3000部。此部分必须包含更新数据库的代码。通常情况下,进行查询事务,本节将不包含任何代码。

    The 4000 Section

    最后,MAINF将执行4000部分。4000部分是用来控制的程序传递。变量WSSP-PROGRAM-PTR用于驱动来执行程序堆栈中的下一个程序。在程序体内,你不必写任何EXIT语句

    文件类型

    *CBL Cobol program
    *CL Control Language job stream
    *CLP Control Language program
    *CMD Command
    *CPY Copybook
    *DSPF Display file
    *INS Scribe Insert document
    *LF Logical file
    *LFU Logical file (used by)
    *ORD Ordinary transaction screen
    *PARM Parameter screen
    *PF Physical file
    *PRTF Printer file
    *SFL Subfile screen
    *SPF Scribe parameter file
    *SUB Submenu screen
    *TXT Scribe text document
    *WORK Work Unit
    *XDD Extra data dated screen
    *XDM Extra data multiple screen
    *XDPT Extra data print routine
    *XDS Extra data screen

  • 相关阅读:
    简化单例模式
    static
    单例模式之懒汉模式
    Car race game
    poj-2403
    poj-2612
    poj-1833
    poj--2782
    poj--2608
    poj--3086
  • 原文地址:https://www.cnblogs.com/starcrm/p/5786800.html
Copyright © 2011-2022 走看看