WDSC tips/Compile

From MidrangeWiki
< WDSC tips
Revision as of 07:48, 22 April 2016 by PabloMotte3 (talk | contribs) (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)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

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