In order to further enhance the functionality of Notepad++ when editing a PeopleSoft SQR, it would be great if it could be run from within notepad++ and display the results or just compile the SQR and see if there are any syntax errors. This can be accomplished with Notepad++ using the NppExec plugin that comes installed by default.
Below are the steps to accomplish this task
- Determine the properly command for running a SQR in your environment.
Example: C:\psoft\FSDEV\bin\sqr\mss\binw\sqrw.exe MySqr.sqr Database/Username/password -ZIFC:\psoft\FSDEV\sqr\PSSQR.ini -ic:\psoft\FSDEV\custom\sqr\;c:\psoft\FSDEV\sqr\ -oc:\temp\sqr.log
It's a good idea to ensure you have this part right first. Also you can see I included Database/Username/Password. This format is for MSSQL or DB2. If you are using Oracle, the format is UserName/Password@Database. If you exclude this option you will be prompted when the SQR runs.
- Modfy the above statement so it will use the current document in Notepad++ by replacing the MySqr.sqr with $(FULL_CURRENT_PATH). (We'll use this statement later)
Example: C:\psoft\FSDEV\bin\sqr\mss\binw\sqrw.exe "$(FULL_CURRENT_PATH)"
Database/Username/password -ZIFC:\psoft\FSDEV\sqr\PSSQR.ini
-ic:\psoft\FSDEV\custom\sqr\;c:\psoft\FSDEV\sqr\ -oc:\temp\sqr.log
- Open Notepad++. Click Plugins->NppExec->Execute (Or press F6)
- In the Command(s): box enter the statement from #2 and on the next line enter CMD /c type yourlogfilepath (The path after the -o arguement in the command line.
Example:
C:\psoft\FSDEV\bin\sqr\mss\binw\sqrw.exe "$(FULL_CURRENT_PATH)"
Database/Username/password -ZIFC:\psoft\FSDEV\sqr\PSSQR.ini
-ic:\psoft\FSDEV\custom\sqr\;c:\psoft\FSDEV\sqr\ -oc:\temp\sqr.log
CMD /c type c:\temp\sqr.log
- Click the Save button, type in Run SQR, Click Save, then click Cancel
- We are going to do the same thing for the syntax checking command but the script will have two differents, an extra -RS paramenter for SQRW and a line to delete the compiled SQR.
So Click Plugins->NppExec->Execute
- Enter a script similar to the following: (I've marked the changes in bold)
C:\psoft\FSDEV\bin\sqr\mss\binw\sqrw.exe "$(FULL_CURRENT_PATH)"
Database/Username/password -RS -ZIFC:\psoft\FSDEV\sqr\PSSQR.ini
-ic:\psoft\FSDEV\custom\sqr\;c:\psoft\FSDEV\sqr\ -oc:\temp\sqr.log
CMD /c type c:\temp\sqr.log
cmd /c del "$(CURRENT_DIRECTORY)\$(NAME_PART).sqt"
- Click Save, Type in Check SQR Syntax, Click Save, then click Cancel
- Click Plugins->NppExec->Advanced Options...
- From the Associated Scripts Dropdown list, Choose the Run SQR script and click the Add button. Then choose the Check SQR Syntax script from the Dropdown list and click Add
- Ensure the checkbox for "Place to the Macros Submenu" is checked and that [Console] "Visible on Start" is Yes, then click OK
- You should get a message you need to restart Notepad++. Once you close and reopen Notepad++, look under the "Macros" menu and you should see your two new commands.
- Now we'll take this one step further and associate these two commands so you can use a key to check the syntax or run the sqr
Click Settings->Shortcut Mapper
- Click the "Plugins commands" button, Scroll down until you see your two new commands, Double click on them and enter the key you want to use for each one. I used F9, F10. Click Close
( Becareful the key you choose and if it is used for another purpose you can get some strange results ) .
- Your done!
If you found this helpful, please check out one of the ads on the page. Thx!