Tuesday 20 January 2015

Execute shell commands using Java Runtime in PeopleCode

Java Runtime class can be used to execute shell commands in PeopleCode and capture the output. The example below executes UNIX grep command to count the number of non-blank rows in a file and store the output into a variable.

   Local string &cmd;
   Local number &fileRowCount;
   Local JavaObject &command, &runtime, &process, &inputStreamReader, &bufferedReader;
  
   &cmd = "grep -v ^$ " | &fileName | " | wc -l";
  
   &command = CreateJavaObject("java.lang.String[]", "sh", "-c", &cmd);
   &runtime = GetJavaClass("java.lang.Runtime").getRuntime();
   &process = &runtime.exec(&command);
  
   &inputStreamReader = CreateJavaObject("java.io.InputStreamReader", &process.getInputStream());
   &bufferedReader = CreateJavaObject("java.io.BufferedReader", &inputStreamReader);
   &fileRowCount = &bufferedReader.readLine();

Tuesday 13 January 2015

PeopleSoft Forms Approval History in PeopleTools 8.52

SQL to review PeopleSoft Forms Approval History in PeopleTools 8.52:

SELECT E.FORM_TYPE,
  A.SEQ_NBR,
  E.FORM_SUBJECT,
  A.EOAWREQUESTOR_ID, -- PERSON WHO SUBMITTED THE WORKFLOW
  C.OPRID,            -- APPROVER
  D.XLATLONGNAME,     -- CURRENT APPROVAL STATUS
  C.DTTM_CREATED,     -- APPROVAL SUBMITTED DATE TIME
  C.EOAWDTTM_MODIFIED -- APPROVAL MODIFIED DATE TIME
FROM SYSADM.PS_FORM_AW A,
  SYSADM.PS_EOAW_STEPINST B,
  SYSADM.PS_EOAW_USERINST C,
  SYSADM.PSXLATITEM D,
  SYSADM.PS_FORM E
WHERE B.EOAWTHREAD_ID = A.EOAWTHREAD_ID
AND B.EOAWPRCS_ID     = A.EOAWPRCS_ID
AND B.EOAWDEFN_ID     = A.EOAWDEFN_ID
AND B.EFFDT           =
  (SELECT MAX(B_ED.EFFDT)
  FROM SYSADM.PS_EOAW_STEPINST B_ED
  WHERE B.EOAWTHREAD_ID   = B_ED.EOAWTHREAD_ID
  AND B.EOAWSTEP_INSTANCE = B_ED.EOAWSTEP_INSTANCE
  AND B.EOAWPRCS_ID       = B_ED.EOAWPRCS_ID
  AND B.EOAWDEFN_ID       = B_ED.EOAWDEFN_ID
  AND B_ED.EFFDT         <= SYSDATE
  )
AND C.EOAWUSTEP_INST_ID =
  (SELECT MAX(C1.EOAWUSTEP_INST_ID)
  FROM SYSADM.PS_EOAW_USERINST C1
  WHERE C1.EOAWSTEP_INSTANCE = B.EOAWSTEP_INSTANCE
  )
AND D.FIELDNAME  = 'EOAWSTEP_STATUS'
AND D.FIELDVALUE = C.EOAWSTEP_STATUS
AND D.EFFDT      =
  (SELECT MAX(D_ED.EFFDT)
  FROM SYSADM.PSXLATITEM D_ED
  WHERE D.FIELDNAME = D_ED.FIELDNAME
  AND D.FIELDVALUE  = D_ED.FIELDVALUE
  AND D_ED.EFFDT   <= SYSDATE
  )
AND D.EFF_STATUS = 'A'
AND E.SEQ_NBR    = A.SEQ_NBR
ORDER BY E.FORM_TYPE, A.SEQ_NBR, B.EOAWTHREAD_ID, B.EOAWSTEP_INSTANCE;
 

Friday 9 September 2011

"3 Idiots" make it to Dudhsagar Falls!


This is my first travelogue. Hope you will enjoy reading! The travelogue in the link below inspired us to go to this place. Thanks to Harish, Ben and Raghu.




http://www.youtube.com/watch?v=4bapm5HBNKU


We all got tempted looking at the photos posted and immediately booked our train tickets on Aug 3rd for the weekend of Sep 10-11. It was a long wait. Both onward and return tickets were wait listed but got confirmed 4 days before our journey.


Sep 9: We boarded the Chennai Vasco Express (Train No 17311) at 2 PM and just kept chatting & waiting for the day to end.


Sep 10: We woke up around 6 AM and our train reached Hubli South station. We could see mist all around and it was such an exciting moment. Clicked couple of snaps and then the train headed towards Hubli.







Followed by Hubli was Dharwar and then Londa which is famous for Vada Pavs. Finished our breakfast with Vada Pavs and Idlies. From Londa the landscape changed completely and it was very scenic and green everywhere. Next came Castle Rock. The train halts here for 10-15 mins to attach 2 more engines to the front. Many trekkers get down in this station and walk to the falls which is about 14 kms.

Following are the stations after Castle Rock where the trains stop ONLY to give way for other trains coming from the opposite direction:


Caranzol - 7 kms walk to the falls
Dudhsagar - 1 km walk to the falls
Sonalium - 3 kms walk to the falls

Sequence of stations:
Londa - Castle Rock - Caranzol - Dudhsagar - Sonalium - Kulem - Kuddchoddem - Madgaon

Dudhsagar falls is located between Dudhsagar and Sonalium stations. Our original plan was to proceed towards Madgaon, stay overnight in a hotel and walk to the falls (10 kms) from Kulem next day morning. But we got so excited that we changed our plan to get down if train stopped at Caranzol. Luck favored us and the train stopped at Caranzol. We got down and it was 10:30 AM. We started walking towards Dudhsagar Falls - 7 kms ahead.






It was drizzling and not raining. So we were able to take lot of photos. There were lot of streams on the way. We had the umbrella open even inside the tunnels since they were leaky and water was pouring down through the gaps.













We reached Dudhsagar station around 12:45 PM when we saw the first train going towards Kulem. It was a goods train and it stopped at Dudhsagar station. We enquired the station master about the next train going towards Kulem and were told that the Amravathi Express from Howrah was running late and expected to arrive around 1:30 PM. We then quickly proceeded towards the falls with the plan to spend some time at the falls and walk back to Dudhsagar station to catch the Amravathi Express.

After reaching the falls, we saw the railway staff arranging chairs and lunch. On enquiry we came to know that the Railways GM was coming in a special train (with just 2 coaches attached to an engine :) to visit the falls and the Amravathi Express would reach Dudhsagar station only after his train arrives. So we knew for sure that we can spend time near the falls till the GM's special train arrives.





The falls was gorgeous and we all got drenched in the shower caused by the water gushing down with full force. After spending about 1.5 hrs taking snaps and admiring the beauty of nature in monsoon, the Railways GM arrived amidst tight security.









We wanted to spend more time but were not ready to wait for the next goods train (arrival time unknown since goods train dont have a schedule) towards Kulem. So we started walking towards Dudhsagar station and boarded the Amravathi Express.

The train left Dudhsagar at 2:30 PM and reached Madgaon at 4 PM. Checked into the hotel, had a nice shower and finished the snacks we had brought within minutes. We then went out for a stroll, had dinner and slept early since we were very tired.

Sep 11: Checked out of the hotel around 10:30 AM. Took a bus to Colva beach. Spent sometime in the beach and came back to Madgaon station.



Boarded Vasco Nizamuddin (also referred as "Super" or "Goa Express" - Train No 12779) train at 3:45 PM. The return journey between Kulem and Londa was equally enjoyable with train going through scenic views of the ghats filled with mist.









Train reached Londa at 6:30 PM and the last 3-4 coaches were disconnected from the Vasco Nizamuddin Express. We were then connected to the Rani Chennamma Express (Train No 16590) which arrived at 8 PM.

Sep 12: Reached Bangalore at 7:30 AM. Got refreshed in a lodge. Boarded Brindhavan Express at 2 PM and reached Chennai at 9 PM.

List of items:
Dress wrapped in plastic bag
Medicines
Umbrella
BIG Torch + Spare Batteries
Cigarette Lighter
Foldable Knife
Volini Spray
Glucon D
Salt for Leech
Energy Bars
Biscuits
2 plastic bags for wet clothes

 Info:
  • Best time to visit - July & August. September is okay but not the best. Compare my photos with the ones uploaded in the link above and you will realize why I say July & August is the best time to visit the falls.
  • We didnt come across any animals (except monkeys), leeches or snakes.
  • Some of the tunnels were completely dark and hence carrying a torch is a MUST. Get a big torch since we had a tough time with small ones.
  • Railway staff are very polite, kind and helpful. Especially I read in some blogs that the loco pilots are very friendly. They agree to give lift and refuse to accept money even if offered.
  • There are no direct trains from Vasco to Chennai on Sunday, so we had to come via Bangalore.
  • We stayed at LaFlor hotel in Madgaon - 7 kms from the Colva beach. Food was okay. We heard from the auto driver that there are many good hotels near the Colva beach.
We could see water bottles and other plastic items on the way and near the falls. Please do not litter the place with plastic items. Let's preserve the beauty of this place for our children to enjoy when they grow up :)

Overall it was a memorable trip. If you are a nature lover then you should definitely make an attempt to visit this place. I am not a fan of blogging. But I decided to write this blog for 2 reasons - to keep the memories of our trip evergreen and encourage nature lovers to visit this heavenly place.

If you need more info, feel free to mail me - ac.vino at gmail dot com and I will get back to you asap!