Chinaunix首页 | 论坛 | 博客
  • 博客访问: 55987
  • 博文数量: 18
  • 博客积分: 161
  • 博客等级: 入伍新兵
  • 技术积分: 135
  • 用 户 组: 普通用户
  • 注册时间: 2012-03-14 21:52
文章分类
文章存档

2012年(18)

分类: LINUX

2012-04-16 22:07:03

转自:http://blog.163.com/xiao_maomao_chong/blog/static/3168623920071171254982/ 

TEST

检查一个DATE/TIME/TIMESTAMP变量是否搬含有效的值。

如果我们要检查的一个变量是DATE/TIME/TIMESTAMP类型的变量,那么:

C  DATE/TIME/TIMESTAMP FORMATE     TEST(E)                         DATE/TIME/TIMESTAMP    

如果我们要检查的是一个Char/Num类型的变量,那么:

C  DATE FORMATE                    TEST(DE)                                DATE

C  TIME FORMATE                    TEST(ET)                                TIME

C  TIMESTAMPE FORMATE      TEST(EZ)                        TIMESTAMP

例:

    *  Indicator 18 will not be set on, since the character field is a   

    *  valid *ISO timestamp field, without separators.                   

     C     *ISO0         TEST (Z)                Char_TSGMp             18  

    *  Indicator 19 will not be set on, since the character field is a  

    *  valid *MDY date, without separators.                          

     C     *MDY0         TEST (D)                Char_Date              19   

    *  %ERROR will return '1', since Num_Date is not *DMY.               

     C     *DMY          TEST (DE)               Num_Date       

    *  No Factor 1 since result is a D data type field          

    *  %ERROR will return '0', since the field                  

    *  contains a valid date                                  

     C                   TEST (E)                Datefield   

    * In the following test, %ERROR will return '1' since the  

    * Timefield does not contain a valid USA time.            

     C     *USA          TEST (ET)               Char_Time      

    *  In the following test, indicator 20 will be set on since the

    *  character field is a valid *CMDY, but there are separators. 

     C     *CMDY0        TEST (D)                char_date2             20

    *  In the following test, %ERROR will return '0' since    

    *  the character field is a valid *LONGJUL date.         

     C     *LONGJUL      TEST (DE)               char_date3   

时间类型关键字:

  

   *YEARS for the year (*Y)

  

   *MONTHS for the month (*M)

  

   *DAYS for the day of the month (*D)

  

   *HOURS for the hours (*H)

  

   *MINUTES for the minutes (*MN)

  

   *SECONDS for the seconds (*S)

改变了一些操作码的写法

RETRNàRETURN

UPDATàUPDATE

LOKUPàLOOKUP

COMIT->COMMIT

DEFN->DEFINE

DELET->DELETE

EXCPT->EXCEPT

REDPE->READPE

SELEC->SELECT

SETOF->SETOFF

UNLCK->UNLOCK

附:RPG III RPG IV 的实体名称长度区别

              Description                                        RPG III                               RPG IV

              Field/Array Name                 6                                                      10

              DS Name                                                        6                                                      10

              Record Name                                     8                                                      10

              File Name                                          8                                                      10

              Max Number of Files            50                                                     None

              Character Field Size              256                                                   32767

              Named Constant                   256                                                   1024

              DS Size                                             9999                                   32767

              No of Decimal Places           9                                                      30

              No of Array Elements           9999                                   32767

              No of Subroutine                  256                                                   None

4.可视化调试(源级调试)

ILE 提供允许源级调试的调试程序,可随列表文件一起使用调试程序,并且允许设置中断点、显示变量或进入或跨过一条指令。执行这些操作不一定要通过命令行输入命令。可以通过热键实现。

预备工作:在使用CRTRPGMOD或者CRTBNDRPG编译程序的时候,将参数DBGVIEW设置为*SOURCE

开始调试程序:

       STRDBG   PGM(MYLIB/MYPGM)    UPDPROD(*YES)

结束调试:

       ENDDBG

调试命令:

       显示一个变量的值:

                     EVAL 变量名/结构名                         热键:F11

       显示一个指针变量的值:

                     EVAL 变量名:C                显示字节数

       改变一个变量的值:

                     EVAL 变量名=xxxx

       显示一个变量的属性:

                     ATTR      变量名

       删除一个断点:

                     CLEAR   行号                                                 热键:F6

       删除一个WATCH

                     CLEAR WATCH 变量名

       增加一个断点:                                                                          BREAK   行号                                   热键:F6

       向前执行N行:                                                                         STEP 行数

       增加一个WATCH:使程序停止在一个指定变量的值发生变化的时候

                     WATCH  变量名                                                           热键:F17

       在源程序中查找一个字符串:                                       FIND 字符串                                    反复查找热键:F16

       使调试窗口显示的源程序向上///右滚动:

                     向上滚:                                                                                                  UP 行数

                            向下滚:                                                                                                  DOWN   行数

                            向左滚:                                                                                                  LEFT      行数                                   热键:F19

                            向右滚:                                                                                                  RIGHT    行数                                   热键:F20

                            向上滚到程序头:                                                                      TOP

                            向下滚到程序尾:                                                                      BOTTOM

                            在调试窗口显示下一个断点:                         NEXT

                            在调试窗口显示上一个断点:                         PREVIOUS

              显示在线帮助:                                                                          HELP

              结束程序:                                                                                               F3

              显示上一个用过的调试命令:                                       F9

              单步执行:                                                                                               F10

              运行到下一断点处:                                                                   F12

              察看当前所有的WATCH变量:                                    F18

              调出命令窗口:                                                                          F21

              进入一个被调用的程序(STEP INTO):         F22

              显示输出画面:                                                                          F23        

                   举例 学生成绩管理

 

1.建库、源文件、物理文件成员、 逻辑文件成员并编译成员

A.建立一个库            STDLIB

CRTLIB   STDLIB  *PROD

B.在库STUDENT下建立一个源文件     STDSRCF

CRTSRCF  FILE(STDLIB/STDSRCF) IGCDTA(*YES) TEXT('SRCPF FOR STUDENTS')

C 在库STUDENT源文件       STDSRCF下建立物理文件成员REFF(数据字典)和STDPF

                     STRSEU   F4  或进入STDSRCF下按F6

STRSEU SRCFILE(STDLIB/STDSRCF) SRCMBR(REFF) TYPE(PF) TEXT('pf for student’)

STRSEU SRCFILE(STDLIB/STDSRCF) SRCMBR(STDPF) TYPE(PF) TEXT('pf for student’)

 

D 在库STUDENT源文件       STDSRCF下建立逻辑文件成员STDLF

                     STRSEU   F4  或进入STDSRCF下按F6

STRSEU SRCFILE(STDLIB/STDSRCF) SRCMBR(STDLF) TYPE(LF) TEXT('Lf for student’)

 

2.分别用DFUSQL、和通过RPGLE程序对学生学籍进行增加、修改、查询、删除记录操作

ADFU

UPDDTA  STGDA

BSQL

增加:INSERT INTO STDPF 。。。

查询:SELECT * FROM STDPF WHERE 。。。

       修改:UPDATE STDPF SET 。。。 WHERE 。。。

       删除:DELETE FROM STDPF WHERE 。。。

CRPGLE

       增加记录:WRITE

       查询:CHAIN

       修改:UPDATE

       删除:DELETE

3.编写程序实现某年段学生成绩的基本管理

1. 统计每个学生的总分并更新数据存储

2. 根据总分排出每个学生在年级的名次(SRL_GRD)

学号            姓 名           年级名次

    STNUMB  STNAME          SRL_GRD

3. 根据总分排出每个学生在班级的名次(SRL_CLS)

 

班级                       STCLAS 

学号                                                    班级名次

STNUMB              STNAME                          SRL_CLS

 

4. 年级各科平均分、及格率、优秀率(及格、优秀分数线分别为6085

                            语文                    数学                    英语                    物理                      化学

    平均分          A11             A12             A13             A14             A15

    及格率          A21             A22             A23             A24             A25

    优秀率          A31             A32             A33             A34             A35

5. 假如把学校学生分为四类ABCD,他们分数线分别为A>=9090>B>=7575>C>=6060>D>=0,计算各班班主任和语文教师的积分,积分=(A类学生个数*5+B类学生个数*3+C类学生个数)/总学生个数

    班级                    班主任                          语文老师       

              TM_CLAS                     B1                          B2    

 

阅读(1870) | 评论(0) | 转发(1) |
给主人留下些什么吧!~~