赞
踩
RPG 是一种超古老的程序语言,但还有不少大银行主机上仍然有好多 RPG 程序在跑
这种程序语言主要用来生成报表,个人觉得功能超牛b,而且当今还没有其他语言可以做到它的效果
RPG 现在主要可以分2个版本,一个是 RPG IV 以前的,和 RPG IV 以后到现在的版本
RPG IV 主要也是银行在用,但它是在 小型机上运行,不是主机,操作系统是 AIX,语法接近现在
这里安装的是老一代的 RPG,这一代的 RPG 特别之处就是它是按数据行来执行程序的
例如: 银行白天的交易生成了一个档案,每一行代表一笔交易內容,用 Java 写小程序来处理一个,是在代码层面去 Loop record 然后处理
RPG 特別就是它的程序码原生的应用在每一行数据
读一行数据,然后,RPG 的代码都会应用在这一行数据
读下一行数据,也是应用同一串代码
没其他多余的
运行速度超快,某些系统例如信用卡系统每天交易数据可能是几十万,甚至百万条
晚上跑批程序运行的速度是一个好重要的考虑
想学习 RPG,先要弄个 RPG 编译器
现在网上硕果仅存的就是下面这个大神整理的 SYSCPK 卷
http://www.jaymoseley.com/hercules/compilers/syscpk.htm
如果没弄到RPG 编译器,那只有在公司机器加班学习...
主机上的东西都是放在卷 (TAPE 磁带) 里面,接上就可以用,卷的名字一般 6 个字
大神整理的这个叫 SYSCPK,里面包含几十种古老编译器
由于大神用的系统是旧一点 MVS,不能直接按照安装在 z/OS 的
但步骤不难,只要有一点悟性就可以参透大神的意思
首先在大神那下把 SYSCPK 下载回来,卷其实就像现在的压缩档而已
然后在 Hercules 挂上,就像下面的 0A9B 3390 DASD /home/kazuya/zos/SYSCPK
- Hercules CPU: 2% z/Arch | Peripherals
- 0706000000000000 0000000000000000 | U Addr Modl Type Assignment
- PSW 24..W....Z | A 000C 3505 RDR /home/kazuya/zos/zzsacard.bin ebcdic intrq IO[6]
- | B 000D 3525 PCH /home/kazuya/zos/punch00d.txt ascii IO[0]
- 0 0000000000000000 1 FF00000000000000 | C 000E 1403 PRT /home/kazuya/zos/print00e.txt crlf IO[6]
- 2 0000000000000000 3 FF00000000000000 | D 0009 3215 CON *syscons cmdpref(/) noprompt IO[0]
- 4 0000000000000000 5 8000000000000000 | E 0700 3270 DSP 192.168.50.16 IO[152]
- 6 0000000000000000 7 0000000000000000 | F 0701 3270 DSP 192.168.50.16 IO[963]
- 8 FF00000000000000 9 0000000000000000 | G 0702 3270 DSP * IO[5]
- A 0000000000000000 B FF00000000000000 | H 0703 3270 DSP * IO[5]
- C 8000000000000000 D 0000000000000000 | I 0704 3270 DSP * IO[5]
- E 7F00000000000000 F FF00000000000000 | J 0A80 3390 DASD /home/kazuya/zos/ZARES1 [3339 cyls] [0 sfs] IO[53402]
- GPR CR AR FPR | K 0A81 3390 DASD /home/kazuya/zos/ZARES2 [3339 cyls] [0 sfs] IO[23896]
- | L 0A82 3390 DASD /home/kazuya/zos/SARES1 [3339 cyls] [0 sfs] IO[6]
- ADDRESS: 00000000 DATA: 00000000 | M 0A83 3390 DASD /home/kazuya/zos/ZADB81 [3339 cyls] [0 sfs] IO[6]
- --------------------------------------| N 0A84 3390 DASD /home/kazuya/zos/ZADB82 [3339 cyls] [0 sfs] IO[6]
- 3.797 3 STO DIS RST | O 0A85 3390 DASD /home/kazuya/zos/ZADB83 [3339 cyls] [0 sfs] IO[6]
- MIPS IO/s | P 0A86 3390 DASD /home/kazuya/zos/ZADB84 [3339 cyls] [0 sfs] IO[6]
- STR STP EXT IPL PWR | Q 0A87 3390 DASD /home/kazuya/zos/ZADB91 [3339 cyls] [0 sfs] IO[4483]
- --------------------------------------| R 0A88 3390 DASD /home/kazuya/zos/ZADB92 [3339 cyls] [0 sfs] IO[198]
- CP00 | S 0A89 3390 DASD /home/kazuya/zos/ZACIC1 [3339 cyls] [0 sfs] IO[3916]
- CP01 | T 0A8A 3390 DASD /home/kazuya/zos/ZADIS1 [3339 cyls] [0 sfs] IO[6]
- CP02 | U 0A8B 3390 DASD /home/kazuya/zos/ZADIS2 [3339 cyls] [0 sfs] IO[6]
- CP03 | V 0A8C 3390 DASD /home/kazuya/zos/ZADIS3 [3339 cyls] [0 sfs] IO[6]
- CP04 | W 0A8D 3390 DASD /home/kazuya/zos/ZADIS4 [3339 cyls] [0 sfs] IO[6]
- CP05 | X 0A8E 3390 DASD /home/kazuya/zos/ZADIS5 [3339 cyls] [0 sfs] IO[6]
- CP06 | Y 0A8F 3390 DASD /home/kazuya/zos/ZADIS6 [3339 cyls] [0 sfs] IO[6]
- CP07 | Z 0A90 3390 DASD /home/kazuya/zos/ZAIMS1 [3339 cyls] [0 sfs] IO[6]
- | . 0A91 3390 DASD /home/kazuya/zos/ZAPRD1 [3339 cyls] [0 sfs] IO[71]
- | . 0A92 3390 DASD /home/kazuya/zos/ZAPRD2 [3339 cyls] [0 sfs] IO[1777]
- | . 0A93 3390 DASD /home/kazuya/zos/ZAPRD3 [3339 cyls] [0 sfs] IO[6]
- | . 0A94 3390 DASD /home/kazuya/zos/ZAPRD4 [3339 cyls] [0 sfs] IO[6]
- | . 0A95 3390 DASD /home/kazuya/zos/ZASYS1 [3339 cyls] [0 sfs] IO[29870]
- | . 0A96 3390 DASD /home/kazuya/zos/ZAUSS1 [3339 cyls] [0 sfs] IO[1541]
- | . 0A97 3390 DASD /home/kazuya/zos/ZAWAS1 [3339 cyls] [0 sfs] IO[6]
- | . 0A98 3390 DASD /home/kazuya/zos/ZAWAS2 [3339 cyls] [0 sfs] IO[6]
- | . 0A99 3390 DASD /home/kazuya/zos/ZAWAS3 [3339 cyls] [0 sfs] IO[6]
- | . 0A9A 3390 DASD /home/kazuya/zos/USRG01 [1114 cyls] IO[91]
- | . 0A9B 3390 DASD /home/kazuya/zos/SYSCPK [1114 cyls] [0 sfs] IO[1095]
- | . 0A9C 3390 DASD /home/kazuya/zos/UAPP01 [1114 cyls] IO[71]
- | . 0A9D 3390 DASD /home/kazuya/zos/UTMP01 [1114 cyls] IO[89]
- | . 0E20 3088 CTCA CTCI 192.168.200.1/192.168.200.2 (tun0) IO[14]
- | . 0E21 3088 CTCA CTCI 192.168.200.1/192.168.200.2 (tun0) IO[7]
- |
- |
挂上后会在 VOLUME SYSCPK 盘里面,基本就可以访问了
- . Menu Options View Utilities Compilers Help .
- . ssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssss .
- . DSLIST - Data Sets on volume SYSCPK Row 11 of 64 .
- . Command ===> Scroll ===> CSR .
- . .
- . Command - Enter "/" to select action Message Volume .
- . ------------------------------------------------------------------------------- .
- . SYSC.A68CLIB.MOD SYSCPK .
- . SYSC.A68CLIB.SYS SYSCPK .
- . SYSC.COBLIB SYSCPK .
- . SYSC.DISASM.ASM SYSCPK .
- . SYSC.DYNALLOC.SOURCE SYSCPK .
- . SYSC.DYNALOAD.SOURCE SYSCPK .
- . SYSC.FORMAT.SOURCE SYSCPK .
- . SYSC.FORTLIB SYSCPK .
- . SYSC.IFOX.CNTL SYSCPK .
- . SYSC.IFOX.MACLIB SYSCPK .
- . SYSC.IFOX.SOURCE SYSCPK .
- . SYSC.JOBCARD.SOURCE SYSCPK .
- . SYSC.LINKLIB SYSCPK .
- . SYSC.MACLIB SYSCPK .
- . SYSC.MORTRAN.SOURCE SYSCPK .
- . SYSC.MVTSORT.CNTL SYSCPK .
- . SYSC.MVTSORT.MACLIB SYSCPK .
- . SYSC.MVTSORT.SOURCE SYSCPK .
- . SYSC.PASCAL.CNTL SYSCPK .
- . SYSC.PASCAL.PASLIB SYSCPK .
- . SYSC.PASCAL.PASMSGS SYSCPK .
- . SYSC.PASCAL.PASOBJ1 SYSCPK .
- . SYSC.PASCAL.PASOBJ2 SYSCPK .
- . SYSC.PLILIB SYSCPK .
- . SYSC.PL360.SOURCE SYSCPK .
- . SYSC.PROCLIB SYSCPK .
- . SYSC.SETUP.CNTL SYSCPK .
- . SYSC.SORTLIB SYSCPK .
- . SYSC.SP.MACLIB SYSCPK .
- . SYSC.SPASM.MACLIB SYSCPK .
- . SYSC.SPASM.SOURCE SYSCPK .
- . SYSC.SPITBOL.SOURCE SYSCPK .
- . SYSC.STANFORD.PASCAL.LIB SYSCPK .
- . SYSC.STONYBRK.PASCAL.OBJECT SYSCPK .
- . SYSC.STONYBRK.PASCAL.SOURCE SYSCPK .
- . SYSC.VSAMIO.SOURCE SYSCPK .
- . SYSC.VSAMIOP.MACLIB SYSCPK .
- . SYSC.VSAMIOP.SOURCE SYSCPK .
- . SYSC.WATFIV.CNTL SYSCPK .
- . SYSC.WATFIV.FUNLIB SYSCPK .
- . SYSC.WATFIV.MACLIB SYSCPK .
- . SYSC.WATFIV.SOURCE SYSCPK .
- . SYSC.WATFIV.TESTS SYSCPK .
- . SYSC.WATFIV.WATLIB SYSCPK .
- . SYSC.XPL.LOADLIB SYSCPK .
- . SYSC.XPL.OBJECT SYSCPK .
- . SYSC.XPL.SOURCE SYSCPK .
- . SYSC.Y2K.SOURCE SYSCPK .
- . SYSD.PL1LIB SYSCPK .
- . SYS1.COBLIB SYSCPK .
- . SYS1.VVDS.VSYSCPK SYSCPK .
- . UCAT.SYSCPK SYSCPK .
- . UCAT.SYSCPK.CATINDEX SYSCPK .
- . Z9999994.VSAMDSPC.TCDD7D03.T4090F30 SYSCPK .
- . ***************************** End of Data Set list **************************** .
如果要 RPG 编译器,只需要 SYSC.PROCLIB 和 SYSC.LINKLIB 就可以
平常在 Windows/Linux 编译 C 程序,也要配置 /usr/bin /usr/lib 这些,SYSC.PROCLIB SYSC.LINKLIB 也相类似
在主机里,有一个叫 CATALOG.Z110.MASTER 东西,就像索引
如果在 CATALOG 里定义了,系统就可以找到相关东西,像找到 /usr/bin 里面东西一样
主机索引支持多层索引,上面是系统主索引
先为这个 SYSCPK 建立一个用户级索引 UCAT.SYSCPK,指到主索引 CATALOG.Z110.MASTER
- //JC$CRTCC JOB ,'CREATE USERCAT',NOTIFY=&SYSUID
- //*
- //STEP0001 EXEC PGM=IDCAMS
- //SYSPRINT DD SYSOUT=*
- //SYSIN DD *
- DELETE UCAT.SYSCPK USERCATALOG
- SET MAXCC=0
- DEFINE USERCATALOG(NAME(UCAT.SYSCPK) -
- VOLUMES(SYSCPK) -
- CYLINDERS(2 1)) -
- CATALOG(CATALOG.Z110.MASTER)
- /*
- //*
再定义个分身 Alias SYSC 指到 UCAT.SYSCPK
- //JC$CRTCA JOB ,'CREATE ALIAS',NOTIFY=&SYSUID
- //*
- //STEP0001 EXEC PGM=IDCAMS
- //SYSPRINT DD SYSOUT=*
- //SYSIN DD *
- DEFINE ALIAS (NAME (SYSC) RELATE (UCAT.SYSCPK))
- /*
- //*
然后把 SYSC.PROCLIB SYSC.LINKLIB 也指到 UCAT.SYSCPK
- //JC$CRTCC JOB ,'CREATE CATL',NOTIFY=&SYSUID
- //*
- //S1 EXEC PGM=IDCAMS
- //SYSPRINT DD SYSOUT=*
- //SYSIN DD *
- DEFINE NONVSAM(NAME(SYSC.PROCLIB)-
- VOL(SYSCPK) DEVT(3390))-
- CATALOG(UCAT.SYSCPK)
-
- DEFINE NONVSAM(NAME(SYSC.LINKLIB)-
- VOL(SYSCPK) DEVT(3390))-
- CATALOG(UCAT.SYSCPK)
- /*
- //*
这样编译程序时就可以找到编译器了
然后,就可以尝试编译大神提供的范例 RPG 程序
- //RPG00001 JOB ,'RPG00001',CLASS=A,MSGLEVEL=(1,1),REGION=512K,
- // NOTIFY=&SYSUID
- //PROCLIB JCLLIB ORDER=SYSC.PROCLIB
- //* COMPILE LINK AND RUN RPG
- //RPGCLG EXEC RPGECLG,COND.LKED=(9,LT,RPG)
- //RPG.SYSUT3 DD UNIT=SYSDA
- //RPG.SYSUT2 DD UNIT=SYSDA
- //RPG.SYSUT1 DD UNIT=SYSDA
- //RPG.SYSGO DD UNIT=SYSDA
- //RPG.SYSIN DD *
- H
- H*
- H* READ ADDRESS CARDS AND PRINT ADDRESS LIST
- H*
- FINCARDS IPE F 80 80 READ40
- FOUTLIST O F 132 132 OF LPRINTER
- LOUTLIST 0010106012
- IINCARDS AA 01
- I 1 25 NAME
- I 26 50 ADDR1
- I 51 75 ADDR2
- OOUTLIST H 201 1P
- O OR OF
- O PAGE Z 40
- O 36 'PAGE'
- O 23 'ADDRESS LIST'
- O UDATE 8 ' 0/ / '
- O D 1 01
- O NAME 30
- O D 1 01
- O ADDR1 30
- O D 2 01
- O ADDR2 30
- O T 3 01 LR
- O 24 '*** END OF LIST ***'
- /*
- //GO.SYSUDUMP DD SYSOUT=A
- //GO.INCARDS DD *
- MICHELLE COOK 9561 BAYVIEW STREET BALDWIN, MO 63022
- PATTY JENNINGS 806 JACKSON STREET VALPARAISO, IN 46383
- RICHARD SMITH 279 PARKER BLVD NASHAU, NH 03060
- DUNCAN POWERS 9496 BAYVIEW STREET BUFFALO, NY 14225
- WILLIAM EUBANKS 736 FETLOCK AVENUE FALLS VILLAGE, CT 06031
- SHIRLEY GARLAND 827 SHORE AVENUE GREENVILLE, SC 29616
- JOAN FRANKLIN 4550 BIENVILLE CIRCLE KANSAS CITY, MO 64118
- ANDREW BLUME 2942 BAYVIEW AVENUE ROCHESTER, NY 03840
- ELIZABETH BOWERS 1023 SOUTHLAND STREET RIVERSIDE, NJ 08370
- DIANE HAMMOND 3732 BENSON CIRCLE FORT COLLINS, CO 80524
- LUCY ROSS 208 ALLEN PLACE EVERETT, WA 98204
- LISA ELISON 488 WESTRIDGE STREET SPARKS, NV 89431
- MATTHEW RIGHT 6267 BRIARGLEN PLACE CLEVELAND, OH 44104
- ZELDA BARBER 442 COLISEUM STREET ALBANY, NY 12206
- BRIAN HARMON 872 GRANT BLVD WICHITA, KS 67208
- NATHAN MCKAY 1184 JUNIPER CIRCLE HOUSTON, TX 77053
- LUCY JACOBY 144 MEADOW PLACE SPARKS, NV 89431
- SCOTT PARRISH 9387 A & M CIRCLE DES PLAINES, IL 60018
- CALVIN MULL 5924 TWILIGHT COURT SPARKS, NV 89431
- CYBIL NOELKE 6782 BRIDGE CIRCLE LAGO VISTA, TX 78645
- RUTH VANACKER 6021 BAYSHORE CIRCLE NEWPORT BEACH, CA 92663
- JARED BROCKTON 761 GARRETT AVENUE GREENVILLE, SC 29616
- MATTHEW JACKSON 4691 SHERWOOD STREET LA JOLLA, CA 92037
- CALVIN POWERS 867 ALLEN STREET SPRING, TX 77373
- SUE SMITH 9848 PLUM STREET PALM DESERT, CA 92211
- ARNOLD WEAVER 701 TWILIGHT ROAD KNOXVILLE, TN 37932
- KEVIN NORTON 5343 PARSON AVENUE JUNEAU, AK 99801
- SCOTT RENFRO 5418 ATOLL ROAD PASADENA, CA 91186
- ERNIE LABROIE 2913 BRANDYWINE CIRCL SAN ANGELO, TX 76903
- SHARON JACKSON 2934 ROSA LINDA AVENU NEW YORK, NY 10001
- PETER ALEXANDER 7444 ROBINHOOD ROAD NEW YORK, NY 10001
- SHARON EUBANKS 9619 JUNIPER ROAD SIOUX FALLS, SD 57112
- SHIRLEY ERICKSON 596 COLLEGE STREET GRAND RAPIDS, MN 55745
- ANN STUART 9581 DESERT STREET OKLAHOMA CITY, OK 73120
- SUE FONTAINE 2229 WESTRIDGE STREET SAN ANTONIO, TX 78216
- KEVIN COOK 3055 ROSA LINDA STREE DES PLAINES, IL 60018
- DIANE EUBANKS 4404 SOUTHLAND BLVD PRESCOTT, AZ 86314
- BOB JEFFERSON 542 KINGS RIDGE BLVD NEWPORT, RI 02840
- CRAIG LANDERS 6276 ELLIS STREET ANN ARBOR, MI 48107
- NELSON HORTON 3066 SHERWOOD ROAD NORWALK, CT 06854
- KEITH ERICKSON 227 BAYSHORE PLACE GREENVILLE, KY 42345
- RICHARD GOODWIN 294 RIDGEWAY ROAD OKLAHOMA CITY, OK 73120
- DANIEL ROBERTSON 379 ALTAVISTA CIRCLE EVERETT, WA 98204
- JOAN AUSTIN 203 EASTHAVEN STREET NEWPORT, RI 02840
- JARED MEEHAN 555 EDMUND CIRCLE EVERETT, WA 98204
- CRAIG STONE 6791 GUADLAUPE COURT WEST PALM BEACH, FL 33406
- JACOB SCHAEFER 8278 LINDENWOOD AVENU JUNEAU, AK 99801
- JARED HILLFORD 846 QUAIL AVENUE PHOENIX, AZ 85040
- CLIFF PARKER 674 BRANDYWINE AVENUE LAGO VISTA, TX 78645
- JOHN SCHAEFER 7210 PARSON COURT LA HABRA, CA 90631
- /*
- //GO.OUTLIST DD SYSOUT=A
- //
编译成功后 Max-CC 0000
- Display Filter View Print Options Help
- ---------------------------------------------------------------------------------------------------------------------------------------------------------------
- SDSF HELD OUTPUT DISPLAY ALL CLASSES LINES 119 LINE 1-1 (1)
- COMMAND INPUT ===> SCROLL ===> CSR
- PREFIX=** DEST=(ALL) OWNER=** SORT=CrDate/D FILTERS=1 SYSNAME=
- NP JOBNAME JobID Owner Max-RC Prty C ODisp Dest Tot-Rec Tot-Page Forms FCB Status UCS Wtr Flash Burst PrMode R
- RPG00001 JOB00053 IBMUSER CC 0000 144 K HOLD LOCAL 119 STD **** **** **** NO LINE
也可以找到输出
- Display Filter View Print Options Help
- ------------------------------------------------------------------------------
- SDSF OUTPUT DISPLAY RPG00001 JOB00053 DSID 107 LINE 0 COLUMNS 02- 161
- COMMAND INPUT ===> SCROLL ===> CSR
- ********************************* TOP OF DATA *********************************
-
- 9/04/21 ADDRESS LIST PAGE 1
- MICHELLE COOK
- 9561 BAYVIEW STREET
- BALDWIN, MO 63022
- PATTY JENNINGS
- 806 JACKSON STREET
- VALPARAISO, IN 46383
- RICHARD SMITH
- 279 PARKER BLVD
- NASHAU, NH 03060
- DUNCAN POWERS
- 9496 BAYVIEW STREET
- BUFFALO, NY 14225
- WILLIAM EUBANKS
- 736 FETLOCK AVENUE
- FALLS VILLAGE, CT 06031
- SHIRLEY GARLAND
- 827 SHORE AVENUE
- GREENVILLE, SC 29616
- JOAN FRANKLIN
- 4550 BIENVILLE CIRCLE
- KANSAS CITY, MO 64118
- ANDREW BLUME
- 2942 BAYVIEW AVENUE
- ROCHESTER, NY 03840
- ELIZABETH BOWERS
- 1023 SOUTHLAND STREET
- RIVERSIDE, NJ 08370
- DIANE HAMMOND
- 3732 BENSON CIRCLE
- FORT COLLINS, CO 80524
- LUCY ROSS
- 208 ALLEN PLACE
- EVERETT, WA 98204
- LISA ELISON
- 488 WESTRIDGE STREET
- SPARKS, NV 89431
- MATTHEW RIGHT
- 6267 BRIARGLEN PLACE
- CLEVELAND, OH 44104
- ZELDA BARBER
- 442 COLISEUM STREET
- ALBANY, NY 12206
- BRIAN HARMON
- 872 GRANT BLVD
- WICHITA, KS 67208
如果直接用大神步骤 IMPORT 来安装 SYSCPK 又不成功,可以参考下面指令清除错误加到主索引的东西
- DELETE SYSC ALIAS CATALOG(CATALOG.Z110.MASTER)
- DELETE UCSYSCPK PURGE USERCATALOG
- EXPORT UCSYSCPK DISCONNECT
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。