This adds the project to the PL/I Explorer view.
The editor appears with skeleton code for opdemo.pli.
OPDEMO: PROC(JCLPARM) OPTIONS(MAIN) REORDER; DCL JCLPARM CHAR(20) VARYING; /*-------------------------------------------------------------------*/ /* F I L E S */ /*-------------------------------------------------------------------*/ DCL SYSIN FILE RECORD INPUT ENVIRONMENT(FB RECSIZE(80)); DCL SYSUT1 FILE RECORD INPUT ENVIRONMENT(FB RECSIZE(80)); DCL SYSUT2 FILE RECORD OUTPUT ENVIRONMENT(FB RECSIZE(80)); DCL SYSPRINT FILE STREAM OUTPUT PRINT ENV (F RECSIZE (132)); /*-------------------------------------------------------------------*/ /* S T R U C T U R E S & A R R A Y S */ /*-------------------------------------------------------------------*/ /*-------------------------------------------------------------------*/ /* E X T E R N A L E N T R I E S */ /*-------------------------------------------------------------------*/ /*-------------------------------------------------------------------*/ /* O T H E R V A R I A B L E S */ /*-------------------------------------------------------------------*/ DCL ACCUMULATOR FIXED BIN(31) INIT(1); DCL ASCII_ALPHABET char(38) init('!ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789 '); DCL chTemp char(1); DCL EBCDIC_ALPHABET char(38) init ('5AC1C2C3C4C5C6C7C8C9D1D2D3D4D5D6D7D8D9E2E3E4E5E6E7E8E9'x || 'F0F1F2F3F4F5F6F7F8F940'x); DCL EOF_SYSIN CHAR(1) INIT('0'); DCL EOF_SYSUT1 CHAR(1) INIT('0'); DCL ITERATIONS FIXED BIN(31) INIT(0); DCL JCLTRANS CHAR(20) VARYING; DCL REC_BUFF char(80); DCL REPLY_STR CHAR(120) VARYING; DCL STATIC_STR CHAR(200) varying init('Hi Dave - this is your static string'); DCL SYSIN_NUM_RECS PIC '9999'; DCL SYSPRINT_BUFF CHAR(132); DCL VAR_NUMERIC PIC '9999'; /*-------------------------------------------------------------------*/ /* B U I L T I N F U N C T I O N S */ /*-------------------------------------------------------------------*/ DCL PLIRETC BUILTIN; DCL TRANSLATE BUILTIN; DCL DELAY BUILTIN; /*-------------------------------------------------------------------*/ /* M O D U L E L O G I C */ /*-------------------------------------------------------------------*/ on error begin; PUT SKIP LIST('On Error Triggered' || oncode()); goto AFTERON; end; on conversion begin; PUT SKIP LIST('On Conversion Triggered'); goto AFTERON; end; ON ENDFILE (SYSIN) begin; EOF_SYSIN = '1'; put skip list('SYSIN EOF Reached - Num Recs: ' || sysin_num_recs); end; ON ENDFILE (SYSUT1) begin; EOF_SYSUT1 = '1'; put skip list('SYSUT1 EOF Reached'); end; SYSPRINT_BUFF = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' || /* 26 */ 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' || /* 52 */ 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' || /* 78 */ 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' || /* 104 */ 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' || /* 130 */ '12'; open file(sysprint); PUT SKIP LIST(SYSPRINT_BUFF); put skip list('Length of JCLPARM: ' || length(jclparm)); PUT DATA(JCLPARM); PUT SKIP; if (JCLPARM = 'DISPLAYREPLY') then do; DISPLAY('STARTING OPDEMO.PLI') REPLY(reply_str); put skip list('Reply String: ' || reply_str); end; else do; /* Read SYSIN to EOF */ sysin_num_recs = '0'; open input file(sysin); do while(eof_sysin = '0'); read file(sysin) into (rec_buff); if (eof_sysin = '0') then sysin_num_recs = sysin_num_recs + 1; end; close file(sysin); end; /***********************************************************/ /* Open SYSUT1 and read until EOF translating records and */ /* Writing them to SYSUT2 */ /***********************************************************/ open file(sysut1) input; open file(sysut2) output; do while(eof_sysut1 = '0'); read file(sysut1) into(rec_buff); if (eof_sysut1 = '0') then do; rec_buff = Translate(rec_buff, ascii_alphabet, ebcdic_alphabet); write file(sysut2) from(rec_buff); end; end; close file(sysut1); close file(sysut2); STARTIT: PUT SKIP DATA(ACCUMULATOR); ACCUMULATOR = ACCUMULATOR + 15; PUT SKIP DATA(ACCUMULATOR); PUT SKIP LIST('Triggering ON Unit'); VAR_NUMERIC = 'DAVE'; PUT SKIP DATA(VAR_NUMERIC); AFTERON: PUT SKIP LIST('SLEEPING for 3 Seconds'); Delay(3000); /* Sleep for 3 seconds */ Iterations = Iterations + 1; /* Let's run for about 6 seconds */ If Iterations < 2 then goto startit; END;
By default, saving a file automatically triggers a build of the project. You can see the progress of the build process in the Eclipse Console view.
The editor appears with skeleton code for opdemo2.pli.
OPDEMO2: PROC(JCLPARM) OPTIONS(MAIN) REORDER; DCL JCLPARM CHAR(20) VARYING; /*-------------------------------------------------------------------*/ /* F I L E S */ /*-------------------------------------------------------------------*/ DCL SYSIN FILE RECORD INPUT ENVIRONMENT(FB RECSIZE(80)); DCL SYSUT1 FILE RECORD INPUT ENVIRONMENT(FB RECSIZE(80)); DCL SYSUT2 FILE RECORD OUTPUT ENVIRONMENT(FB RECSIZE(80)); DCL SYSPRINT FILE STREAM OUTPUT PRINT ENV (F RECSIZE (132)); /*-------------------------------------------------------------------*/ /* S T R U C T U R E S & A R R A Y S */ /*-------------------------------------------------------------------*/ /*-------------------------------------------------------------------*/ /* E X T E R N A L E N T R I E S */ /*-------------------------------------------------------------------*/ /*-------------------------------------------------------------------*/ /* O T H E R V A R I A B L E S */ /*-------------------------------------------------------------------*/ DCL ACCUMULATOR FIXED BIN(31) INIT(1); DCL ASCII_ALPHABET char(38) init('!ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789 '); DCL chTemp char(1); DCL EBCDIC_ALPHABET char(38) init ('5AC1C2C3C4C5C6C7C8C9D1D2D3D4D5D6D7D8D9E2E3E4E5E6E7E8E9'x || 'F0F1F2F3F4F5F6F7F8F940'x); DCL EOF_SYSIN CHAR(1) INIT('0'); DCL EOF_SYSUT1 CHAR(1) INIT('0'); DCL ITERATIONS FIXED BIN(31) INIT(0); DCL JCLTRANS CHAR(20) VARYING; DCL REC_BUFF char(80); DCL REPLY_STR CHAR(120) varying; DCL SYSIN_NUM_RECS PIC '9999'; DCL SYSPRINT_BUFF CHAR(132); DCL VAR_NUMERIC PIC '9999'; /*-------------------------------------------------------------------*/ /* B U I L T I N F U N C T I O N S */ /*-------------------------------------------------------------------*/ DCL DELAY BUILTIN; DCL PLIRETC BUILTIN; DCL TRANSLATE BUILTIN; /*-------------------------------------------------------------------*/ /* M O D U L E L O G I C */ /*-------------------------------------------------------------------*/ on error begin; PUT SKIP LIST('On Error Triggered'); goto AFTERON; end; on conversion begin; PUT SKIP LIST('On Conversion Triggered'); goto AFTERON; end; ON ENDFILE (SYSIN) begin; EOF_SYSIN = '1'; put skip list('SYSIN EOF Reached - Num Recs: ' || sysin_num_recs); end; ON ENDFILE (SYSUT1) begin; EOF_SYSUT1 = '1'; put skip list('SYSUT1 EOF Reached'); end; SYSPRINT_BUFF = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' || /* 26 */ 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' || /* 52 */ 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' || /* 78 */ 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' || /* 104 */ 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' || /* 130 */ '12'; open file(sysprint); PUT SKIP LIST(SYSPRINT_BUFF); put skip list('Length of JCLPARM: ' || length(jclparm)); PUT DATA(JCLPARM); PUT SKIP; if (JCLTRANS = 'DISPLAYREPLY') then DISPLAY('STARTING OPDEMO.PLI') REPLY(reply_str); else do; /* Read SYSIN to EOF */ sysin_num_recs = '0'; open input file(sysin); do while(eof_sysin = '0'); read file(sysin) into (rec_buff); if (eof_sysin = '0') then sysin_num_recs = sysin_num_recs + 1; end; close file(sysin); end; /***********************************************************/ /* Open SYSUT1 and read until EOF translating records and */ /* Writing them to SYSUT2 */ /***********************************************************/ open file(sysut1) input; open file(sysut2) output; do while(eof_sysut1 = '0'); read file(sysut1) into(rec_buff); if (eof_sysut1 = '0') then do; rec_buff = Translate(rec_buff, ascii_alphabet, ebcdic_alphabet); write file(sysut2) from(rec_buff); end; end; close file(sysut1); close file(sysut2); STARTIT: PUT SKIP DATA(ACCUMULATOR); ACCUMULATOR = ACCUMULATOR + 15; PUT SKIP DATA(ACCUMULATOR); PUT SKIP LIST('Triggering ON Unit'); VAR_NUMERIC = 'DAVE'; PUT SKIP DATA(VAR_NUMERIC); AFTERON: PUT SKIP LIST('SLEEPING for 3 Seconds'); Delay(3000); /* Sleep for 3 seconds */ Iterations = Iterations + 1; /* Let's run for about 6 seconds */ If Iterations < 2 then goto startit; END;
When the project builds, the output folder includes two .dll files, one for each .pli file. This is because the default output type is "All executable native libraries" in the build configuration.
//OPDEMO JOB 'OPDEMO',CLASS=A,MSGCLASS=A //************************************************************** //* Demonstrates a simple PL/I program running under //* the control of JCL. //************************************************************** //* Copyright (C) 1985-2017 Micro Focus International Ltd. //* All rights reserved. //************************************************************** //STEP00 EXEC PGM=IEFBR14 //SYSUT2 DD DSN=OPDEMO.SYSUT2,DISP=(MOD,DELETE,DELETE) //* //* Execute the first step with an Open PL/I Binary //* //STEP10 EXEC PGM=OPDEMO,PARM='HEAP(80M,4M,ANY,KEEP)/NODISPLAYREPLY' //SYSUT1 DD * INPUT RECORD NUMBER 1 INPUT RECORD NUMBER 2 INPUT RECORD NUMBER 3 /* //SYSIN DD * SYSIN RECORD 1 SYSIN RECORD 2 SYSIN RECORD 3 SYSIN RECORD 4 /* //SYSOUT DD SYSOUT=* //SYSPRINT DD SYSOUT=*,DCB=(RECFM=F,LRECL=132),HOLD=Y //SYSUT2 DD DSN=OPDEMO.SYSUT2,DISP=(NEW,CATLG), // DCB=(DSORG=PS,LRECL=80,RECFM=FB) //* //* Once is fun, twice is a even better //* //STEP20 EXEC PGM=OPDEMO2, // PARM='HEAP(80M,4M,ANY,KEEP)/SOME STRING HERE' //SYSUT1 DD * INPUT RECORD NUMBER 3 INPUT RECORD NUMBER 4 INPUT RECORD NUMBER 5 /* //SYSIN DD * SYSIN RECORD 1 /* //*SYSOUT DD SYSOUT=* //SYSPRINT DD SYSOUT=*,DCB=(RECFM=F,LRECL=132),HOLD=Y //SYSUT2 DD DSN=OPDEMO.SYSUT2,DISP=MOD //*
This rebuilds the project.