Compile and Run PL/1 with SQL

IBM's cross-platform compiler PL/I for MVS, VM & VSE, OS/390 and Enterprise PL/I for z/OS
admiral00
Posts: 3
Joined: Tue Nov 04, 2014 11:10 am
Skillset: pl/1, db2, sql, jcl
Referer: google

Compile and Run PL/1 with SQL

Postby admiral00 » Wed Nov 05, 2014 11:37 am

Hi!

How can i compile and run a PL/1 Program with SQL inside?

My PL/1 Program:

Code: Select all

MYSQL: PROC OPtions(main);                         
  dcl depno char(5);                               
  dcl depname char(20);                             
  exec sql include sqlca;                           
  /*exec sql include dept272;*/                     
  exec sql                                         
     select depno,depname                           
     into :DEPNO,:DEPNAME                           
     from DSN8910.DEPT                             
     where deptno='E01'M                           
  put skip list('DEPNO IS :',DEPNO);               
  put skip list('DEPNAME IS:',DEPNAME);             
END MYSQL;                                         


My JCL for Compile and Run:

Code: Select all

//IBMUSERX JOB MSGCLASS=A,NOTIFY=IBMUSER,REGION=0M                     
//STEP1 EXEC IBMZCBG,REGION.PLI=32M                     
//STEPLIB DD DSN=IEL370.SIBMZCMP,DISP=SHR               
//PLI.SYSIN DD DSN=IBMUSER.TEST.PL1(MYSQL),DISP=SHR     
//                                                       


I get the Error:

Compiler Messages

Code: Select all

Message       Line.File Message Description                     
IBM1866I S       4.0    The EXEC statement is not supported.     
IBM1866I S       6.0    The EXEC statement is not supported.     
IBM1085I W      12.0    DEPNAME may be uninitialized when used. 

User avatar
prino
Posts: 641
Joined: Wed Mar 11, 2009 12:22 am
Skillset: PL/I - CICS - DB2 - IDMS - REXX - JCL, most in excess of three decades
Referer: Google
Location: Vilnius, Lithuania
Contact:

Re: Compile and Run PL/1 with SQL

Postby prino » Wed Nov 05, 2014 2:36 pm

That is because you do not use the builtin SQL pre-processor...

Code: Select all

//PLI      EXEC PGM=IBMZPLI,PARM='OBJECT,OPTIONS'


As a minimum change this into

Code: Select all

//IBMZPLI EXEC PGM=IBMZPLI,
//             REGION=0M,
//             PARM=('+DD:PLIUSER')


and add a

Code: Select all

IBMZPLI.PLIUSER DD DSN=whatever(PXEP37Z),DISP=SHR


with member PXEP37Z (or whatever you might want to call it) containing, if you want to generate high-quality code, the options below, or your organisation's options, which are likely to be, been there, done that, far less optimal:

Code: Select all

   aggregate(dec)
   arch(7)
   attributes(s)
   backreg(5)
   bifprec(31)
   blank('05'x)
   blkoff
   ceestart(last)
   check(noconformance nostorage)
   cmpat(v2)
   codepage(1140)
 nocommon
 nocompact
   compile
   copyright('(C) Copyright Whatever')
   csect
   csectcut(4)
   currency('$')
 nodbcs
   dd(sysprint,sysin,syslib,syspunch,*,*,*,*)
   dd(*,*,*,*,syslin,sysadata,sysxmlsd,sysdebug)
   decimal(foflonasgn noforcedsign)
   default(ibm)
   default(aligned)
   default(assignable)
   default(byaddr)
   default(connected)
   default(desclocator)
   default(descriptor)
   default(dummy(unaligned))
   default(e(hexadec))
   default(ebcdic)
   default(hexadec)
   default(linkage(optlink))
   default(native)
   default(nativeaddr)
   default(nobin1arg)
   default(noevendec)
   default(noinitfill)
   default(noinline)
   default(nonrecursive)
   default(nooverlap)
   default(noretcode)
   default(null370)
   default(ordinal(max))
   default(reorder)
   default(returns(byaddr))
   default(short(hexadec))
   display(wto)
 nodllinit
 noexit
   extrn(full)
   flag(i)
   float(afp(novolatile) nodfp)
   floatinmath(asis)
   gonumber
 nographic
   incafter(process(''))
 noinitauto
 noinitbased
 noinitctl
 noinitstatic
 nis
 nointerrupt
   langlvl(os saa2)
   limits(extname(7) fixeddec(15,31) fixedbin(31,63) name(31))
   lc(32767)
 nolist
 nomacro
 nomap
   margini(' ')
   mar(2,72,1)
   maxmem(1048576)
   maxmsg(e 32767)
   maxnest(block(8) do(8) if(8))
   maxstmt(2048)
   maxtemp(4096)
   names('#@$','#@$')
   natlang(enu)
   nest
   not('^')
   number
   obj
 nooffset
   opt(3)
   options(all)
   or('|')
   pp(macro('case(asis)'))
   prectype(ans)
 noproceed(s)
   process(delete)
   quote('"')
   reduce
 norent
   resexp
   rules(ibm)
   rules(  byname)
   rules(nodecsize)
   rules(  elseif)
   rules(noevendec)
   rules(nogoto)
   rules(nolaxbif)
   rules(nolaxctl)
   rules(nolaxdcl)
   rules(nolaxdef)
   rules(nolaxif)
   rules(nolaxinout)
   rules(nolaxlink)
   rules(nolaxmargins(xnumeric))
   rules(nolaxpunc)
   rules(  laxqual)
   rules(nolaxsemi)
   rules(nolaxstg)
   rules(nolaxstrz)
   rules(nomulticlose)
   rules(nounref)
   scheduler
   semantic
   service('')
   source
   spill(512)
   static(full)
   stmt
 nostorage
   syntax
   sysparm('')
   system(mvs)
   test(all,sym)
 notest
   tune(7)
   usage(round(ibm))
   usage(unspec(ibm))
   widechar(bigendian)
   window(1950)
   writable
   xref(s)


and change the

Code: Select all

   pp(macro('case(asis)'))


into

Code: Select all

   pp(macro('case(asis)') SQL('RTFM for all six zillion SQL options'))


And then add all required extra datasets to the JOB, such as the DBRMLIB, etc.

And for what it's worth Enterprise PL/I V3.7 is no longer supported, which indicates that you are probably not doing this in a corporate environment.
Robert AH Prins
robert.ah.prins @ the.17+Gb.Google thingy


  • Similar Topics
    Replies
    Views
    Last post