I think people use semi-colon for their search because they think every piece of PeopleCode must have one. This in fact is wrong. Here is a 30 line piece of Record FieldChange PeopleCode that will save and compile using PeopleTools 8.54.13. (Granted - it is non-sensical. But I'm just proving the point that not all PeopleCode must have a semi-colon.)
This PeopleCode program makes use of a wide variety of built-in functions and language constructs, such as:
- If, Else, End-If
- Evaluate, When, When-Other, End-Evaluate
- Upper, Lower, String
- Abs, Max, AccruableDays
- %Date
- For, End-For, Exit
- Try, Throw, Catch, End-Try
- CreateJavaObject, CreateException
- Error, MsgGet
- RECORD.FIELD notation
/* Comment of course */ Evaluate PSOPRDEFN.OPRID When = "VP1" If PSOPRDEFN.OPRID = Upper("cc") And "y" <> "z" Then If ("a" = "B") Then While 1 = 1 PSOPRDEFN.OPRID = Lower("AA") End-While End-If End-If <* Comments too *> When = "PS" If Abs(1.0) = Max(AccruableDays(%Date, %Date, 0)) Then Return End-If When-Other For &intCounter = 1 To PSOPRDEFN.FAILEDLOGINS try If &intCounter = Round(100.12912, 0) Or String(&intCounter) = CreateJavaObject("String", "Hello").concat(" World") Then Exit Else throw CreateException(2, 160, "'%1' doesn't support property or method '%2'", "SomeClass", "SomeMethod") End-If catch Exception &exc Error MsgGet(0, 0, "hello world!") end-try End-For End-Evaluate
; 7th line from last. But nice post and a good warning to those like me who make this very assumption.
ReplyDeleteI thought I had deleted that one. Have updated the PeopleCode snippet to take that ; out. And it still validates and saves.
ReplyDeleteYes, nice post indeed. I am one of those people who tend to use a PeopleCode file created by searching for ;
ReplyDeleteThe Find In features within application designer are improved upon within change impact analyzer, but unfortunately not everyone has access to this tool.
That's great to know about Change Impact Analyzer. I've never had a chance to use it. Will maybe look at that.
DeleteA friend has been in touch and said that a SQL script is another option for doing a Find In PeopleCode. You can use the PCTEXT field on PSPCMTXT.
ReplyDeleteHave you looked at Decode Peoplecode
ReplyDeletehttp://sourceforge.net/projects/decodepcode/files/
Yes, I have seen that in the past. But I have not looked at it recently.
Delete