Difference between revisions of "WDSC tips/Compile"

From MidrangeWiki
Jump to: navigation, search
m (change to {{BASEPAGENAME}} now that sub-pages are enabled.)
(Supporting posts: Added recent posts by Eric Simpson and Thomas Raddatz in regards to Paul Bailey's query about a custom "compile" for IFS-based SQL scripts)
 
(10 intermediate revisions by 2 users not shown)
Line 1: Line 1:
See also main article page [[{{BASEPAGENAME}}]].
 
 
 
==COMPILE==
 
==COMPILE==
 
===RPG source was not being saved===
 
===RPG source was not being saved===
Line 18: Line 16:
 
  as expected.
 
  as expected.
  
Return to [[#TOP]]
+
also see [[WDSC tips/Editor#Downloading source to PC to work offline|Downloading source to PC to work offline]]
 +
 
 +
[[#top]]
  
 
===Error-messages are still showing in the edit view===  
 
===Error-messages are still showing in the edit view===  
Line 41: Line 41:
 
Click the X icon in the top left part of the iSeries Error List view.  (Note: This closes the error list view, but does not clear any errors inserted in the editor window.  However, it is important to remember that the errors are not made a part of the source itself.  They are simply shown in the LPEx editor window.)
 
Click the X icon in the top left part of the iSeries Error List view.  (Note: This closes the error list view, but does not clear any errors inserted in the editor window.  However, it is important to remember that the errors are not made a part of the source itself.  They are simply shown in the LPEx editor window.)
  
Return to [[#TOP]]
+
[[#top]]
  
 
===SQLRPGLE Compiles how to find Compile errors ===
 
===SQLRPGLE Compiles how to find Compile errors ===
 
original post [http://archive.midrange.com/wdsci-l/200602/msg00196.html]
 
original post [http://archive.midrange.com/wdsci-l/200602/msg00196.html]
  
* First turn off Batch compiles (see compile [[WDSC tips#Within RSE, how to compile Interactively versus Batch|Interactively]] tip)
+
* First turn off Batch compiles (see compile [[WDSC tips/Compile#Within RSE, how to compile Interactively versus Batch|Interactively]] tip)
* Next select Compile(Prompt) to see the compile Parms
+
* Next select Compile(Prompt) 'Work with Compile Commands..' to see the compile Parms
* Select CRTSQLRPGI
+
* Select CRTSQLRPGI , click Prompt
 
* Click All Parameters checkbox.
 
* Click All Parameters checkbox.
* Set the 'To source file parm to QSQLSRC in 'your lib' NOT QTEMP.
+
* Set the 'To source file:' parm to QSQLSRC in 'your lib or *libl' NOT [[QTEMP]].
 
The compile will retreive the EVENTS file and show messages in the Iseries Error list View.  
 
The compile will retreive the EVENTS file and show messages in the Iseries Error list View.  
  
Line 65: Line 65:
  
 
FWIW
 
FWIW
*I found some notes on SQL Restrictions
+
*I found some notes on SQL Restrictions in CODE editor General Help
*In WSDC V6 Open the CODE editor
+
*Upgrading to V7 did not install CODE and so the CODE Help got lost, but the information is still very relevent for imbedded SQL in WDSCi.
*Click Help,General Help
 
*Enter 'Code Tips SQL in RPG and Cobol' Click GO
 
*Click 'CODE Tips and Techniques - SQL in RPG and COBOL '
 
*Read 'There are some restrictions you should be aware of:
 
  
Return to [[#TOP]]
+
This is what I recall.
 +
 
 +
# You cant prompt SQL statements, so I copy and paste from the green screen CLI.
 +
# SQL is not syntax checked, you need to check the compile listings for errors.
 +
 
 +
 
 +
[[#top]]
  
 
===Within RSE, how to compile Interactively versus Batch===
 
===Within RSE, how to compile Interactively versus Batch===
Line 82: Line 84:
 
  compile still draws from the Batch CPW of the server.
 
  compile still draws from the Batch CPW of the server.
  
Return to [[#TOP]]
+
[[#top]]
  
 
===Custom Compile Commands===
 
===Custom Compile Commands===
 
====Synopsis====
 
====Synopsis====
 
In order to have WDSC automatically bring up the compile error list when you are using custom compile commands:
 
In order to have WDSC automatically bring up the compile error list when you are using custom compile commands:
*Add {{code|OPTION(*EVENTF) SRCMBR(&N)}} to the end of your compile command.  This tells WDSC that the command being executed is a compile command.  Note that if you have a custom compile command that does not have these parameters, you can append them as a comment: {{code|/* OPTION(*EVENTF) SRCMBR(&N) */}}
+
*Add {{code|OPTION(*EVENTF) SRCMBR(&N)}} to the end of your compile command.  This tells WDSC that the command being executed is a compile command.   
 +
 
 +
There is documentation that says to add {{code|/* OPTION(*EVENTF) SRCMBR(&N) */}} as a comment to the command.  In some cases this does not work.
 +
ref [[http://archive.midrange.com/wdsci-l/200803/msg00167.html]]
 +
 
 
*Make sure that you are setting a *CURLIB.
 
*Make sure that you are setting a *CURLIB.
 
*For OPM compilers, use {{code|OPTION(*LSTDBG)}} or {{code|OPTION(*SRCDBG)}} to trigger creating the event file.
 
*For OPM compilers, use {{code|OPTION(*LSTDBG)}} or {{code|OPTION(*SRCDBG)}} to trigger creating the event file.
Line 118: Line 124:
 
*I spent a fair amount of time going through this, and found the following IT Jungle article invaluable [http://www.itjungle.com/fhg/fhg080404-story01.html] when creating our internal version for WDSC.
 
*I spent a fair amount of time going through this, and found the following IT Jungle article invaluable [http://www.itjungle.com/fhg/fhg080404-story01.html] when creating our internal version for WDSC.
  
Return to [[#TOP]]
+
Eric adds this: [http://archive.midrange.com/wdsci-l/201604/msg00250.html]
 +
*For IFS non-batch commands, it will look for PGM or MODULE parameters in the command string to determine the name of the generated events file.
 +
*For RDi 9.5, documentation already exists for custom commands here: [http://www.ibm.com/support/knowledgecenter/SSAE4W_9.5.0/com.ibm.etools.iseries.rse.doc/topics/tworkcmplcmds.html?lang=en]
 +
 
 +
Thomas adds this: [http://archive.midrange.com/wdsci-l/201604/msg00245.html]
 +
*The STRPREPRC command is included in the [http://isphere.sourceforge.net/ iSphere] plugin for RDi or you can download it from my [http://tools400.de/English/Freeware/Utilities/utilities.html Freeware page]. The STRPREPRC command uses the creation command(s) listed as comments in the source member of an object.
 +
 
 +
[[#top]]

Latest revision as of 12:48, 22 April 2016

COMPILE

RPG source was not being saved

original post [1]

  • A RPG source was not being saved to my source file.

I can see the changes in WDSCi but not in the Iseries source.

  • Another symptom is when debugging I need to select the Listing View as the debugger is finding some old source for the *SOURCE view.
  • I cleared the File Cache and the debug cache.
  • I discovered a work around.
Say the member is PGM001, I renamed it (via WDSCI by right-click on the source and Rename)
to PGM001X, do my changes and save them.  Then I rename the member back to PGM001.
  • But the real problem was in Iseries Projects.
I had previously saved this source in a Project so that I could do work on my home PC. 
When I deleted the member from the Window/Open Perspective/Iseries Project view all worked
as expected.

also see Downloading source to PC to work offline

#top

Error-messages are still showing in the edit view

original post [2]

  • After compiling, getting errors, and fixing them, and recompiling successfully, the error-messages are still showing in the edit view.
  • How to get rid of them with out closing the member
  1. Ctrl+F5,
  2. or either Source>Remove Errors,
  3. or Source>Refresh.
  • Its on IBM's list of requirements to automatically remove these during error list reloads.
  • Remove messages from the source by choosing SOURCE/Remove Messages from the top of the screen.
  • While you have theError List window open,
  1. click on the triangle in the top right corner of the window,
  2. choose Show Severity
  3. and uncheck Information to not show informational messages.
  • From the same menu,
  1. click Messages,
  2. choose Insert Selected Only.

This will only insert the message you click on from the Error List Window into the source, and will remove the previous error message when you choose another from the Error List Window.

Click the X icon in the top left part of the iSeries Error List view. (Note: This closes the error list view, but does not clear any errors inserted in the editor window. However, it is important to remember that the errors are not made a part of the source itself. They are simply shown in the LPEx editor window.)

#top

SQLRPGLE Compiles how to find Compile errors

original post [3]

  • First turn off Batch compiles (see compile Interactively tip)
  • Next select Compile(Prompt) 'Work with Compile Commands..' to see the compile Parms
  • Select CRTSQLRPGI , click Prompt
  • Click All Parameters checkbox.
  • Set the 'To source file:' parm to QSQLSRC in 'your lib or *libl' NOT QTEMP.

The compile will retreive the EVENTS file and show messages in the Iseries Error list View.

You can click on the error and the source will be displayed with the cursor positioned on the error, but be careful as to what source member is in the 'Location' column of the Iseries Error List view.

If the QSQLSRC member is listed you need to open the 'real' source to the same position to do the appropriate correction.

Ctrl-L lets you jump directly to a given line, or you can type the line number in the Editor command line and you go directly to the line.

Should you find Compile(Prompt) to be a pain, you could customise the compile command.

  • In Table View, Right Click a Source,Click Compile , Click Work with Compile commands
  • Select CRTSQLRPGI and Click Edit
  • Add TOSRCFILE(&L/QSQLSRC) to the command, this saves you setting this parm all the time.

FWIW

  • I found some notes on SQL Restrictions in CODE editor General Help
  • Upgrading to V7 did not install CODE and so the CODE Help got lost, but the information is still very relevent for imbedded SQL in WDSCi.

This is what I recall.

  1. You cant prompt SQL statements, so I copy and paste from the green screen CLI.
  2. SQL is not syntax checked, you need to check the compile listings for errors.


#top

Within RSE, how to compile Interactively versus Batch

original post [4]

  • Window -> Preferences -> Remote Systems -> iSeries -> Command execution
There is a compile in batch check box.  Uncheck that because the 
compile still draws from the Batch CPW of the server.

#top

Custom Compile Commands

Synopsis

In order to have WDSC automatically bring up the compile error list when you are using custom compile commands:

  • Add OPTION(*EVENTF) SRCMBR(&N) to the end of your compile command. This tells WDSC that the command being executed is a compile command.

There is documentation that says to add /* OPTION(*EVENTF) SRCMBR(&N) */ as a comment to the command. In some cases this does not work. ref [[5]]

  • Make sure that you are setting a *CURLIB.
  • For OPM compilers, use OPTION(*LSTDBG) or OPTION(*SRCDBG) to trigger creating the event file.

Supporting posts

original post [6]

How to get the error list back into WDSC

  • Make sure that you are setting a *CURLIB. This is very important, because that's how the UI finds the EVFEVENT file generated by the compiler.

Technote 1231854 from ibm.com describes the official IBM help on the subject.

Nazmin adds this: [7]

  • If you are running your compile commands from CL, the Error List View is not automatically opened to populate the errors.
  • However, if you specified an option to generate the events file, say for OPM compiler OPTION(*LSTDBG) or OPTION(*SRCDBG), an event file containing the errors is generated.
  • You can manually open this events file in the Error List view and proceed normally.
  • To locate the events file, look in the target library for the compile command for data file EVFEVENT.
  • If you expand this file, you will see all the events files, with the same name as the source member and type mbr. Right click on this, choose the option to Show in Error List.

Andrew adds this: [8]

  • You can code your own Compiler command, which can then be used to determine which command to run, based on the source member type (you have to write your own code here to retrieve the source type).
  • That will then run the command in question, i.e. CRTSQLCBL, CRTCICSCBL, etc.
  • Your own command has to have a parameter called OPTION, that will accept *EVENTF or *NOEVENTF. The parameter doesn't have to do anything, but it needs to be there.
  • When OPTION(*EVENTF) is specified, WDSC will look in the first 20 bytes of the *LDA. This must contain the library and member for the compiled source, so your compiler front end needs to ensure that the *LDA is correctly populated.
  • Assuming that the *LDA is correct and that your IBM supplied compiler command (called by your front end) has been called with OPTION(*EVENTF) - WDSC will then automatically retrieve the correct event file and switch to that tab in the table view.
  • Depending on your settings, this will also insert the error messages into the source member in the Editor.
  • I spent a fair amount of time going through this, and found the following IT Jungle article invaluable [9] when creating our internal version for WDSC.

Eric adds this: [10]

  • For IFS non-batch commands, it will look for PGM or MODULE parameters in the command string to determine the name of the generated events file.
  • For RDi 9.5, documentation already exists for custom commands here: [11]

Thomas adds this: [12]

  • The STRPREPRC command is included in the iSphere plugin for RDi or you can download it from my Freeware page. The STRPREPRC command uses the creation command(s) listed as comments in the source member of an object.

#top