大型机CobolMainframejcl_第1页
大型机CobolMainframejcl_第2页
大型机CobolMainframejcl_第3页
大型机CobolMainframejcl_第4页
大型机CobolMainframejcl_第5页
已阅读5页,还剩59页未读 继续免费阅读

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

1、1将文件内容在系统中输出/CN001000 JOB MSGLEVEL=(1,1),NOTIFY=&SYSUID/STEP1 EXEC PGM=IEBGENER/SYSPRINT DD SYSOUT=*/SYSUT1 DD DSN=CN0010.XCY.JCL3,DISP=SHR/SYSUT2 DD SYSOUT=*/SYSIN DD DUMMY2 cond的用法,设置判断返回参数以决定是否执行本作业步/CN001000 JOB MSGLEVEL=(1,1),NOTIFY=&SYSUID /STEP1 EXEC PGM=IDCAMS /SYSPRINT DD SYSOUT=*SYSIN DD *

2、 SET MAXCC=8 /* */STEP2 EXEC PGM=IEBGENER,COND=(8,NE,STEP1) /SYSPRINT DD SYSOUT=* /SYSUT1 DD * XCY IS A GOOD BOY! /* /SYSUT2 DD SYSOUT=* /SYSIN DD DUMMY*/STEP3 EXEC PGM=IEBGENER,COND=(8,EQ,STEP1) /SYSPRINT DD SYSOUT=*/SYSUT1 DD *YES HE IS./*/SYSUT2 DD SYSOUT=*/SYSIN DD DUMMY3将两个sds文件复制到一个已有的文件当中/CN0

3、01009 JOB MSGLEVEL=(1,1),NOTIFY=&SYSUID/STEP1 EXEC PGM=IEBGENER/SYSPRINT DD SYSOUT=*/SYSUT1 DD DSN=CN0010.XCY.JCL1,DISP=SHR/ DD DSN=CN0010.XCY.JCL2,DISP=SHR/SYSUT2 DD DSN=CN0010.XCY.JCL3,DISP=SHR/SYSIN DD DUMMY4将一个sds中的数据一部分复制到一个新建立的 sds当中,record选择范围 /CN001000 JOB MSGLEVEL=(1,1),NOTIFY=&SYSUID /COPY

4、 EXEC PGM=IEBGENER /SYSPRINT DD SYSOUT=* /SYSUT1 DDDSN=CN0010.XCY.JCL1,DISP=SHR /SYSUT2 DD DSN=CN0010.XCY.JCL5,DISP=(NEW,CATLG), /UNIT=SYSDA,SPACE=(CYL,(1,1), DCB=(RECFM=FB,LRECL=40,BLKSIZE=800) /SYSIN DD *GENERATE MAXFLDS=5,MAXLITS=4RECORD FIELD=(5,1,1),FIELD=(20,21,6),FIELD=(9,61,ZP,26),FIELD=(9,7

5、0,ZP,31),FIELD=(4,TESr,36)/*5临时数据集的应用/CN001000 JOB NOTIFY=&SYSUID,MSGLEVEL=(1,1)/BUILD EXEC PGM=IEBGENER/SYSPRINT DD SYSOUT=*/SYSUT1 DD *XCY IS A GOOD BOY/SYSUT2 DD DSN=&TEMP1,DISP=(,PASS),/ SPACE=(TRK,(1,1),DCB=(LRECL=80,RECFM=FB),/ UNIT=SYSDA/SYSIN DD DUMMY*/BUILD2 EXEC PGM=IEBGENER/SYSPRINT DD SY

6、SOUT=*/SYSUT1 DD DSN=&TEMP1,DISP=(OLD,DELETE)/SYSUT2 DD DSN=CN0010.XCY.DATA,DISP=(,CATLG,DELETE),/ SPACE=(TRK,(1,1),DCB=(LRECL=80,RECFM=FB),/ UNIT=SYSDA/SYSIN DD DUMMY6将一个sds内容复制到新建立的 pds的一个member中/CN001027 JOB NOTIFY=&SYSUID,MSGLEVEL=(1,1)/STEP1 EXEC PGM=IEBGENER/SYSPRINT DD SYSOUT=*/SYSUT1 DD DSN=

7、CN0010.XCY727.SDS,DISP=SHR/SYSUT2 DD DSN=CN0010.XCY727.XCC(XCY1),DISP=(NEW,CATLG),/ SPACE=(TRK,(1,1,1),VOL=SER=SUER01,UNIT=SYSDA/SYSIN DD DUMMY X7将sds排序输出到另一个sds中,sort field选择排序范围/CN001027 JOB NOTIFY=&SYSUID,MSGLEVEL=(1,1)/STEP1 EXEC PGM=SORT/SYSOUT DD SYSOUT=*/SORTIN DD DSN=CN0010.XCY727.SDS,DISP=S

8、HR/SORTOUT DD DSN=CN0010.XCY727.SDS2,DISP=SHR/SYSIN DD *SORT FIELDS=(1,2,CH,A,9,3,CH,A)/*8将sds排序并去除重复项,输出到另一个 sds中 /CN001027 JOB MSGLEVEL=(1,1),NOTIFY=&SYSUID/STEP1 EXEC PGM=SORT/SYSOUT DD SYSOUT=*/SORTIN DD DSN=CN0010.XCY727.SDS,DISP=SHR/SORTOUT DD DSN=CN0010.XCY727.SDS2,DISP=SHR/SYSIN DD *SORT FIE

9、LDS=(1,3,CH,A)SUM FIELDS=NONE /*8根据排序情况将sds内容分为三个sds,去除重复/CN001027 JOB MSGLEVEL=(1,1),NOTIFY=&SYSUID /STEP1 EXECPGM=SORT /SYSOUT DD SYSOUT=* /SORTIN DDDSN=CN0010.XCY727.SDS,DISP=SHR /SORTOF01 DDDSN=CN0010.XCY727.SDS3,DISP=(NEW,CATLG), /SPACE=(CYL,(1,4),RLSE),DCB=(LRECL=80,RECFM=FB,BLKSIZE=80) /SORTO

10、F02 DD DSN=CN0010.XCY727.SDS4,DISP=(NEW,CATLG), /SPACE=(CYL,(1,4),RLSE),DCB=(LRECL=80,RECFM=FB,BLKSIZE=80) /SORTOF03 DD DSN=CN0010.XCY727.SDS5,DISP=(NEW,CATLG), /SPACE=(CYL,(1,4),RLSE),DCB=(LRECL=80,RECFM=FB,BLKSIZE=80)/SYSIN DD * SORT FIELDS=COPY OUTFILFILES=01,INCLUDE=(1,6,CH,EQ,CMOHANK) OUTFILFIL

11、ES=02,INCLUDE=(1,6,CH,EQ,CSURESH) OUTFILFILES=03,INCLUDE=(1,6,CH,EQ,CKRISHN) /*9创建gdg/CN001027 JOB NOTIFY=CN0010 /*/*CREATE A GDG * /*/GDGCREAT EXEC PGM=IDCAMS /GDGMODEL DDDSN=CN0010.XCY27.GDGMDL,DISP=(NEW,CATLG,DELETE), /SPACE=(TRK,(0),DCB=(RECFM=FB,LRECL=80,BLKSIZE=8000,DSORG=PS)/SYSPRINT DD SYSOU

12、T=*/SYSIN DD * DEFINE GDG(NAME(CN0010.XCY27.GDG) LIMIT(100) /*10在gdg中创建两个数据集/CN001027 JOB NOTIFY=CN0010*/* CREATE 2 DATASETS IN A GDG */CDS1 EXEC PGM=IEBGENER/SYSPRINT DD SYSOUT=*/SYSUT1 DD *THIS LINE IS WRITTEN INTO DATASET IN GDG./SYSUT2 DD DSN=CN0010.XCY27.GDG(+1),DISP=(NEW,CATLG,DELETE), /SPACE=

13、(TRK,(1,1),DCB=CN0010.XCY27.GDGMDL/SYSIN DD DUMMY/CDS2 EXEC PGM=IEFBR14/GDG DD DSN=CN0010.XCY27.GDG(+2),DISP=(NEW,CATLG,DELETE), /SPACE=(TRK,(5,5),DCB=CN0010.XCY27.GDGMDL11删除gdg/CN001027 JOB NOTIFY=CN0010*/* BEFORE DELETING A GDG,WE MUST */* DELETE ALL DATASET IN IT. */DELDS EXEC PGM=IDCAMS/SYSPRINT

14、 DD SYSOUT=*/SYSIN DD *DELETE CN0010.XCY27.GDG.*DELETE CN0010.XCY27.GDGMDL*/DELGDG EXEC PGM=IDCAMS,COND=(0,NE)/SYSPRINT DD SYSOUT=*/SYSIN DD *DELETE CN0010.XCY27.GDG GDG/*12将两组数据排序进两个sds,再用merge合并排序/CN001000 JOB NOTIFY=CN0010 /STEP1 EXEC PGM=SORT /SYSOUT DD SYSOUT=*SORTIN DD * MOHANK 234234234345343

15、44 KIRAN MOHANK 13342345345345345 RAJEEV ARAMES 34535345325354324 SURESH SURESH 98347385385933987 PULI /SORTOUT DD DSN=CN0010.XCY727.SDS,DISP=SHR /SYSIN DD * SORT FIELDS=(1,5,CH,A) /STEP2 EXEC PGM=SORT /SYSOUT DD SYSOUT=* /SORTIN DD * RAMESH 67575789769876785 MADHU KRISHN 50830948530859340 OIIED KRI

16、SHN 30495849572938495 MADHU SURESH 98347385385933987 PULI /SORTOUT DD DSN=CN0010.XCY727.SDS3,DISP=SHR /SYSIN DD *SORT FIELDS=(1,5,CH,A)/STEP3 EXEC PGM=ICEMAN,COND=(0,NE)/SYSOUT DD SYSOUT=*/SORTIN01 DD DSN=CN0010.XCY727.SDS,DISP=SHR /SORTIN02 DD DSN=CN0010.XCY727.SDS3,DISP=SHR /SORTOUT DD DSN=CN0010.

17、XCY727.SDS4,DISP=SHR /SYSIN DD *MERGE FIELDS=(1,5,CH,A) /*13根据局部数据条件(大于400)对数据排序存储 /CN001027 JOB NOTIFY=CN0010/STEP1 EXEC PGM=SORT/SYSOUT DD SYSOUT=*/SORTIN DD DSN=CN0010.XCY727.SDS,DISP=SHR /SORTOUT DD DSN=CN0010.XCY727.SDS2,DISP=SHR /SYSIN DD *SORT FIELDS=COPYINCLUDE COND=(9,3,CH,GT,C400) /* 14 定义

18、一个 vsam esds/CN000928 JOB NOTIFY=CN0001,MSGLEVEL=(1,1) /DELDEF EXEC PGM=IDCAMS /SYSPRINT DD SYSOUT=H /SYSIN DD * DELETE CN0009.EXAMPLE.ESDS1 SET MAXCC=0 DEFINE CLUSTER (NAME(CN0009.EXAMPLE.ESDS1) RECORDS(100 500) RECORDSIZE(70 70)NONINDEXED) DATA (NAME(CN0009.EXAMPLE.ESDS1.DATA) CONTROLINETERVALSIZE

19、(32760) /*/REPROT1 EXEC PGM=IDCAMS /SYSPRINT DD SYSOUT=*/IN1 DD DSN=INVMASTS.DATBIN,DISP=SHR /SYSIN DD * REPRO INFILE(INI) OUTFILE(OUTI) PRINT INFILE(OUTI) CHARACTER /*15 定义一个 vsam ksds/CN000928 JOB NOTIFY=CN0009/STEP1 EXEC PGM=IDCAMS/SYSPRINT DD SYSOUT=*/SYSIN DD *DELETE CN0009.VSAM.KSDS1SET MAXCC=

20、0DEFINE CLUSTER-(NAME(CN0009.VSAM.KSDS1)-VOLUME(USER02)- RECORDS(100,10)- RECORDSIZE(10 20)- CONTROLINTERVALSIZE(4096)- KEYS(1,1)/16定义一个rrds/CN000928 JOB NOTIFY=CN0009/SETP1 EXEC PGM=IDCAMS/SYSPRINT DD SYSOUT=*/SYSIN DD *DELETE CN0009.VSAM.RRDS1SET MAXCC=0DEFINE CLUSTER(NAME(CN0009.VSAM.RRDS1)- NUMB

21、ERED-VOLUME(USER02)-RECORDS(50000,1000)-RECORDSIZE(20 20)-CONTROLINTERVALSIZE(4096) /17 copy 一个 pds所有 members,至U另一个 pds/CN000929 JOB NOTIFY=&SYSUID /STEP1 EXEC PGM=IEBCOPY /SYSPRINT DD SYSOUT=* /SYSUT1 DD DSN=CN0009.XCY28.XCY,DISP=SHR /SYSUT2 DD DSN=CN0009.XCY.XCY,DISP=(NEW,CATLG),SPACE=(TRK,(5,1,2)

22、 18调用流内过程copy/CN000929 JOB NOTIFY=CN0009 /MYPROC PROC INDD=,OUTDD= /CPY EXEC PGM=IEBGENER /SYSPRINT DD SYSOUT=* /SYSUT1 DD DSN=&INDD.,DISP=SHR /SYSUT2 DD DSN=&OUTDD.,DISP=(NEW,CATLG),SPACE=(TRK,(1,1), / DCB=(LRECL=80,RECFM=FB,BLKSIZE=8000) /SYSIN DD DUMMY /MYEND PEND/CPYLOAD EXEC MYPROC,INDD=CN0009.

23、XCY.XCY(XCY), / OUTDD=CN0009.XCY.XCY419创建一个过程(pds的number)/MYPROC PROC INDD=,OUTDD= /CPY EXEC PGM=IEBGENER /SYSPRINT DD SYSOUT=* /SYSUT1 DD DSN=&INDD.,DISP=SHR /SYSUT2 DD DSN=&OUTDD.,DISP=(NEW,CATLG,DELETE), / SPACE=(TRK,(2,1),DCB=(RECFM=FB,LRECL=80,BLKSIZE=240)/SYSIN DD DUMMY20 cobol 显示 hello world

24、IDENTIFICATION DIVISION. PROGRAM-ID. XCY1 ENVIRONMENT DIVISION. DATA DIVISION.PROCEDURE DIVISION.DISPLAY HELLO WORLD! STOP RUN.21 cobol实现简单运算(两数相加) IDENTIFICATION DIVISION.PROGRAM-ID. XCY3.ENVIRONMENT DIVISION.DATA DIVISION.WORKING-STORAGE SECTION.77 C PIC 9(3).77 D PIC 9(3).PROCEDURE DIVISION.ACCEP

25、T C.ACCEPT D.ADD C TO D.DISPLAY D.STOP RUN.22 cobol的混合运算(变量有点混乱) IDENTIFICATION DIVISION.PROGRAM-ID. XCY5.ENVIRONMENT DIVISION.DATA DIVISION.WORKING-STORAGE SECTION.01 A PIC 999 VALUE 100.01 B PIC 999 VALUE 100.01 C PIC 999 VALUE 400.01 D PIC 999 VALUE 100.01 E PIC 999 VALUE 200.01 Y PIC 999 VALUE 1

26、00.01 F PIC 999 VALUE 500.01 Z PIC 999 VALUE 000.01 X PIC 999 VALUE 300.01 T PIC 999 VALUE 500.PROCEDURE DIVISION.A1.ACCEPT A.ACCEPT B.ACCEPT C.ACCEPT D.ACCEPT E.ACCEPT Y.ACCEPT F.ACCEPT T.ACCEPT X.ACCEPT Z.A2.ADD 3 TO A.ADD 101, A TO B.ADD 9, 6, 7 GIVING Y.SUBTRACT B FROM F.SUBTRACT Y FROM X GIVING

27、 Z.SUBTRACT D, E FROM C.SUBTRACT D, E FROM T.A3. DISPLAY PRIMARY VALUES:. DISPLAY A=100, ,B=100, ,C=400,D=100, ,E=200. DISPLAY Y=100, ,F=500, ,Z=000, ,X=300, ,T=500.DISPLAY”*”.DISPLAYTHE REASULTS:. DISPLAY A=3+A=, A. DISPLAY B=101+A+B=, B.DISPLAY Y=9+6+7=, Y. DISPLAY F=F-B=, F. DISPLAY Z=X-Y=, Z.DIS

28、PLAY C=C-D-E=, C. DISPLAY T=T-D-E=, T. STOP RUN.22 cobol混合运算,接着算。IDENTIFICATION DIVISION. PROGRAM-ID.XCY6. ENVIRONMENT DIVISION. DATA DIVISION. WORKING-STORAGESECTION. 77 X1 PIC 99 VALUE 50. 77 X2 PIC 99 VALUE 50. 77 X4 PIC 99VALUE 50. 77 X5 PIC 99 VALUE 50. 77 X6 PIC 99 VALUE 50. 77 X7 PIC 99VALUE

29、50. 77 X8 PIC 99 VALUE 50. 77 X0 PIC 99 VALUE 50. 77 Y1 PIC 99VALUE 20. 77 Y2 PIC 99 VALUE 20. 77 Y4 PIC 99 VALUE 20. 77 Y5 PIC 99VALUE 20. 77 Y7 PIC 99 VALUE 20. 77 Y9 PIC 99 VALUE 20. 77 Y0 PIC 99VALUE 20. 77 Z2 PIC 99 VALUE 10. 77 Z3 PIC 99 VALUE 10. 77 Z5 PIC 99VALUE 10. 77 Z6 PIC 99 VALUE 10. 7

30、7 Z7 PIC 99 VALUE 10. 77 Z8 PIC 99VALUE 10. 77 Z9 PIC 99 VALUE 10. 77 Z0 PIC 99 VALUE 10. PROCEDUREDIVISION. A1. ACCEPT X1. ACCEPT X2. ACCEPT X4. ACCEPT X5. ACCEPT X6.ACCEPT X7.ACCEPT X8.ACCEPT X0.ACCEPT Y1.ACCEPT Y2.ACCEPT Y4.ACCEPT Y5.ACCEPT Y7.ACCEPT Y9.ACCEPT Y0.ACCEPT Z2.ACCEPT Z3.ACCEPT Z5.ACC

31、EPT Z6.ACCEPT Z7.ACCEPT Z8.ACCEPT Z9.ACCEPT Z0.A2. ADD Y1 TO X1. ADD X2 , Z2 TO Y2. ADD 5, 10 GIVING Z3. ADD 10, X4 GIVING Y4. ADD X5, Y5 GIVING Z5. SUBTRACT Z6 FROM X6. SUBTRACT Y7, Z7 FROM X7. SUBTRACT 10, Z8 FROM X8. SUBTRACT Y9, 100 FROM 150 GIVING Z9. SUBTRACT Y0 FROM X0 GIVING Z0. A3. DISPLAY

32、PRIMARYVALUES: DISPLAY X=50,Y=20,Z=10. DISPLAY 、*, display ADD Y TO X:, X1. DISPLAY ADD X, Z TO Y:, Y2. DISPLAY ADD 5, 10 GIVING Z:, Z3. A2. ADD Y1 TO X1. ADD X2 , Z2 TO Y2. ADD 5, 10 GIVING Z3. ADD 10, X4 GIVING Y4. ADD X5, Y5 GIVING Z5. SUBTRACT Z6 FROM X6. SUBTRACT Y7, Z7 FROM X7. SUBTRACT 10, Z8

33、 FROM X8. SUBTRACT Y9, 100 FROM 150 GIVING Z9. SUBTRACT Y0 FROM X0 GIVING Z0. A3. DISPLAY PRIMARY VALUES:DISPLAY X=50,Y=20,Z=10. DISPLAY *.DISPLAY ADD Y TO X:, X1.DISPLAY ADD X, Z TO Y:, Y2. DISPLAY ADD 5, 10 GIVING Z:, Z3.DISPLAY ADD 10, X GIVING Y:, Y4. DISPLAY ADD X, Y GIVING Z:, Z5.DISPLAY SUBTR

34、ACT Z FROM X:, X6. DISPLAY SUBTRACT Y, Z FROM X:, X7. DISPLAY SUBTRACT 10, Z FROM X:, X8. DISPLAY SUBTRACT Y, 100 FROM 150 GIVING Z:, Z9. DISPLAY SUBTRACT Y FROM X GIVING Z:, Z0 STOP RUN.23,混合运算,混合运算! !IDENTIFICATION DIVISION.PROGRAM-ID. XCY7.ENVIRONMENT DIVISION.DATA DIVISION.WORKING-STORAGE SECTIO

35、N.77 A1 PIC 99 VALUE 08.77 A0 PIC 99 VALUE 08.77 B1 PIC 99 VALUE 04.77 B2 PIC 99 VALUE 04.77 B0 PIC 99 VALUE 04.77 C2 PIC 99 VALUE 05.77 C5 PIC 99 VALUE 05.77 X3 PIC 99 VALUE 10.77 X6 PIC 99 VALUE 10.77 X0 PIC 99 VALUE 10.77 Y3 PIC 99 VALUE 50.77 Y6 PIC 99 VALUE 50.77 Y7 PIC 99 VALUE 50.77 Y0 PIC 99

36、 VALUE 50.77 Z3 PIC 9999 VALUE 1000.77 T4 PIC 99 VALUE 50.77 T7 PIC 99 VALUE 50.77 D5 PIC 99 VALUE 10.77 F5 PIC 99 VALUE 12.77 N8 PIC 99 VALUE 60.77 K8 PIC 99 VALUE 30.77 J8 PIC 99 VALUE 30.77 SUM9 PIC 99 VALUE 14.77 TOTOL9 PIC 99 VALUE 30.PROCEDURE DIVISION.A4.ACCEPT A1.ACCEPT A0.ACCEPT B1.ACCEPT B

37、2.ACCEPT B0.ACCEPT C2.ACCEPT C5.ACCEPT X3.ACCEPT X6.ACCEPT X0.ACCEPT Y3.ACCEPT Y6.ACCEPT Y7.ACCEPT Y0.ACCEPT Z3.ACCEPT T4.ACCEPT T7.ACCEPT D5.ACCEPT F5.ACCEPT N8.ACCEPT K8.ACCEPT J8.ACCEPT SUM9. ACCEPT TOTOL9. A2. MULTIPLY A1 BY B1. MULTIPLY B2BY B2 GIVING C2. MULTIPLY X3 BY Y3 GIVING Z3. MULTIPLY 3

38、 BY 5GIVING T4. MULTIPLY C5 BY D5. MULTIPLY C5 BY F5. DIVIDE Y6 BY X6GIVING Y6. DIVIDE T7 INTO 150 GIVING Y7. DIVIDE N8 BY K8 GIVING J8.DIVIDE 7 INTO SUM9 GIVING TOTOL9. DIVIDE A0 BY B0 GIVING X0. DIVIDEB0 INTO A0 GIVING Y0. A3. DISPLAY PRIMARY VALUES:. DISPLAY A=8,B=4,C=5,X=10,Y=50,D=10,F=12.DISPLA

39、Y T=50,N=60,K=30,SUM=14. DISPLAY*. display B=A*B=:, B1.DISPLAY C=B*B=:, C2.DISPLAY Z=X*Y=:, Z3. DISPLAY T=3*5=:, T4. DISPLAY D=C*D=:, D5.DISPLAY F=C*F=:, F5. DISPLAY Y=Y/X=:, Y6. DISPLAY Y=150/T=:, Y7.DISPLAY J=N/K=:, J8. DISPLAY TOTOL=SUM/7=:, TOTOL9. DISPLAY X=A/B=:, X0. DISPLAY Y=A/B=:, Y0. STOP

40、RUN.24混合运算,混合晕着算。IDENTIFICATION DIVISION.PROGRAM-ID. XCY9.ENVIRONMENT DIVISION.DATA DIVISION.WORKING-STORAGE SECTION.77 A1 PIC 99 VALUE 50.77 A5 PIC 99 VALUE 50.77 B1 PIC 99 VALUE 50.77 B5 PIC 99 VALUE 50.77 S12 PIC 99 VALUE 00.77 T1 PIC 99 VALUE 00.77 T2 PIC 99 VALUE 02.77 T4 PIC 99 VALUE 02.77 U2

41、PIC 99 VALUE 10.77 U4 PIC 99 VALUE 10.77 K4 PIC 99 VALUE 10.77 X3 PIC 999 VALUE 50077 Y3 PIC 99 VALUE 05.77 Y1 PIC 99 VALUE 10.77 Y2 PIC 99 VALUE 10.77 C1 PIC 99 VALUE 10.77 C5 PIC 99 VALUE 10.77 D1 PIC 99 VALUE 10.77 D5 PIC 99 VALUE 10.77 Z3 PIC 99 VALUE 04.77 R4 PIC 99 VALUE 00.77 V4 PIC 99 VALUE

42、03.PROCEDURE DIVISION.A4.ACCEPT A1.ACCEPT A5.ACCEPT B1.ACCEPT B5.ACCEPT S12.ACCEPT T1.ACCEPT T2.ACCEPT T4.ACCEPT U2.ACCEPT U4.ACCEPT K4.ACCEPT X3.ACCEPT Y3.ACCEPT Y1.ACCEPT Y2.ACCEPT C1.ACCEPT C5.ACCEPT D1.ACCEPT D5.ACCEPT Z3.ACCEPT R4.ACCEPT V4. A6. COMPUTE T1 = (A1 + B1) / (C1 + D1). COMPUTE S12 =

43、 (T2 * 2 + 5) * (U2 + 4) - 3) / 8.COMPUTE X3 = Y3 * 2 + Z3 * 2 - Y3 * Z3. COMPUTE R4 = - T4 + K4 / 2 + U4 *V4 * 2. COMPUTE Y3 = (Y1 + Y2) / (A5 + B5) * (C5 + D5) / Y2).A2. DISPLAY PRIMARY VALUES:. DISPLAY A=50,B=50,C=10,D=10,T=2.DISPLAY U=10,V=3,Y=5,Z=4,Y1=Y2=10,K=10. DISPLAY* DISPLAY”*”T=(A+B)/(C+D

44、尸”,T1. DISPLAY S12 =(T*2+5)*(U+4)-3)/8=, S12. DISPLAY X=Y*2+Z*2 -Y*Z=, X3. DISPLAY R= -T+K/2+U*V*2=, R4. DISPLAY Y3=(Y1+Y2)/(A+B)*(C+D)/Y2)=, Y3.STOP RUN.25读文件和写文件(read, write, perform) IDENTIFICATION DIVISION.PROGRAM-ID. XCY8.ENVIRONMENT DIVISION.INPUT-OUTPUT SECTION.FILE-CONTROL.SELECT IN-PUT ASSI

45、GN TO INFILE.SELECT OUT-PUT ASSIGN TO OUTFILE.DATA DIVISION.FILE SECTION.FD IN-PUT.01 INPUT-RECORD.05 IN-STUDENT-NUMBER PIC X(10).05 IN-STUDENT-CLASS PIC X(10).05 IN-STUDENT-NAME PIC X(10).FD OUT-PUT.01 OUTPUT-RECORD.05 OUT-STUDENT-NUMBER PIC X(10).05 OUT-STUDENT-CLASS PIC X(10).05 OUT-STUDENT-NAME

46、PIC X(10).WORKING-STORAGE SECTION.77 FILE-EOF PIC X VALUE N.PROCEDURE DIVISION.OPEN INPUT IN-PUTOUTPUT OUT-PUT.PERFORM XCY-WRITE UNTIL FILE-EOF = Y.CLOSE IN-PUT.CLOSE OUT-PUT.STOP RUN.XCY-WRITE.READ IN-PUT AT END MOVE Y TO FILE-EOF.IF FILE-EOF = NMOVE IN-STUDENT-NUMBER TO OUT-STUDENT-NUMBER MOVE INS

47、TUDENT-NAME TO OUT-STUDENT-NAME WRITE OUTPUT-RECORD.26 move语句的数值类型应用 IDENTIFICATION DIVISION. PROGRAM-ID. XCY1. ENVIRONMENT DIVISION. DATA DIVISION.WORKING-STORAGE SECTION. 77 Y1 PIC 9(4) VALUE 8512. 77 Y2 PIC 9(4) VALUE 8512. 77 Y3 PIC 9(4) VALUE 8512. 77 Y4 PIC 9(4) VALUE 8512. 77 Y5 PIC 9(4) VALU

48、E 8512. 77 Y6 PIC 9(4) VALUE 8512. PROCEDURE DIVISION. A1. ACCEPT Y1. ACCEPT Y2. ACCEPT Y3. ACCEPT Y4. ACCEPT Y5. ACCEPT Y6. A2. MOVE 12.34 TO Y1. MOVE 123 TO Y2. MOVE 1 TO Y3. MOVE 81245 TO Y4. MOVE 87.3 TO Y5. MOVE ZERO TO Y6. A3. DISPLAY PRIMARY Y=8512. DISPLAY *. DISPLAY MOVE 12.34 TO Y:, Y1.DIS

49、PLAY MOVE 123 TO Y:, Y2. DISPLAY MOVE 1 TO Y:, Y3. DISPLAY MOVE 81245 TO Y:, Y4. DISPLAY MOVE 87.3 TO Y:, Y5. DISPLAY MOVE ZERO TO Y:, Y6. STOP RUN.27对s9类型数据赋值(-99),输出(以下不是输出结果,模拟图片而 已。)IDENTIFICATION DIVISION.PROGRAM-ID. XCY3.ENVIRONMENT DIVISION.DATA DIVISION.WORKING-STORAGE SECTION.77 XCY PIC S9.

50、77 XCY1 PIC 99.PROCEDURE DIVISION.A1.ACCEPT XCY.MOVE -9 TO XCY.ACCEPT XCY1.MOVE 00 TO XCY1.A2.PERFORM XCY-GIVE UNTIL XCY1 EQUAL 19.STOP RUN.XCY-GIVE.DISPLAY XCYADD 1 TO XCY.ADD 1 TO XCY1.98765432-0 -& 9-hgfedcba-jklmnopqR28 move对字符的控制,关于数据项的填充。乱七八糟IDENTIFICATIONDIVISION.PROGRAM-ID. XCY2. ENVIRONMENT

51、DIVISION.DATA DIVISION.WORKING-STORAGESECTION.01 T.05 T1 PIC X(3) VALUE FUN. 05 T2 PIC X(3) VALUE TAN. 05 T3 PIC X(3) VALUE WAN. PROCEDURE DIVISION. A1. ACCEPT T1.ACCEPT T2.ACCEPT T3.DISPLAY T=X(9),T1=T2=T3=X(3).DISPLAY *.A2. MOVE LIA TO T1. DISPLAY MOVE LIA TO T1:, T1. MOVE CHI TO T1, T2. DISPLAY M

52、OVE CHI TO T2:, T2. MOVE LI TO T3. DISPLAY MOVE LI TO T3:, T3. MOVE COBOL PRO TO T. DISPLAY MOVE COBOL PRO TO T:, T. MOVE COBOL PROGRAM TO T. DISPLAY MOVE COBOL PROGRAM TO T:, T. MOVE CHINA TO T3. DISPLAY MOVE CHINA TO T3:, T3. MOVE SHANGHAI TO T. DISPLAY MOVE SHANGHAI TO T:, T. MOVE BEIJING TO T2.

53、DISPLAY MOVE BEIJING TO T2:, T2. MOVE 186 TO T1. DISPLAY MOVE 186 TO T1:, T1. MOVE 2010 TO T.IDENTIFICATION DIVISION. PROGRAM-ID. XCY4. ENVIRONMENT DIVISION. INPUT-OUTPUT SECTION. FILE-CONTROL. SELECT IN-FILE ASSIGN TO INFILE. SELECT OUT-FILE ASSIGN TO OUTFILE. DATA DIVISION. FILE SECTION. FD IN-FILE. 01 IN-DETAILS. 02 STUDENTID PIC 9(7). 02 STUDENTNAME. 03 SURNAME PIC X(8). 03 INITIALS PIC XX. 02 DATEOFBIRTH. 03 YOBIRTH PIC 9(4). 03 MOBIRTH PIC 9(2). 03 DOBIRTH PIC 9(2). 02 COURSECODE P

温馨提示

  • 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
  • 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

评论

0/150

提交评论