Quick in Batch directing info statements to a log file
Ken Langendock
ken.langendock at rogers.com
Wed Jan 13 13:23:54 CST 2010
This worked PERFECTLY……
Of course I had to embellish it a little…
I will test the UNIX version later.
Thanks
PROCEDURE INTERNAL Update-Logfile
BEGIN
@if WINDOWS
IF " " EQ T-AuditLine
THEN LET T-AuditCommand &
= "echo. >> " &
+ DOWNSHIFT(TRUNCATE(T-ProgramId)) &
+ ".log"
ELSE LET T-AuditCommand &
= "echo " &
+ TRUNCATE(T-AuditLine) &
+ " >> " &
+ DOWNSHIFT(TRUNCATE(T-ProgramId)) &
+ ".log"
@else
LET T-AuditCommand &
= "echo " &
+ TRUNCATE(T-AuditLine) &
+ " >> " &
+ DOWNSHIFT(TRUNCATE(T-ProgramId)) &
+ ".log"
@endif
@if QKC
RUN COMMAND T-AuditCommand ON ERROR CONTINUE CLEAR ALL NOWARN
@else
RUN COMMAND T-AuditCommand ON ERROR CONTINUE NOCONSOLE
@endif
END
PROCEDURE INITIALIZE
BEGIN
LET T-AuditLine &
= "Starting at " &
+ ASCII(SYSDATE,8)[5:2] + "/" &
+ ASCII(SYSDATE,8)[7:2] + "/" &
+ ASCII(SYSDATE,8)[1:4] + " " &
+ ASCII(SYSTIME,8)[1:2] + ":" &
+ ASCII(SYSTIME,8)[3:2] + ":" &
+ ASCII(SYSTIME,8)[5:2] + ":" &
+ ASCII(SYSTIME,8)[7:2]
DO INTERNAL Update-Logfile
WHILE RETRIEVING ecb100da & ; detail records
SEQUENTIAL
BEGIN
LET T-RecordsRead = T-RecordsRead + 1
IF " " NE MyField OF ecb100da
THEN BEGIN
LET T-RecordsProcessed = T-RecordsProcessed + 1
LET T-AuditLine &
= " " ; blank line
DO INTERNAL Update-Logfile
LET T-AuditLine &
= "Read " &
+ CIPNo OF ecb100da + " " &
+ ServiceLine OF ecb100da &
+ " Transform " &
+ Transform OF ecb100da
DO INTERNAL Update-Logfile DO INTERNAL Process-This-Record
END
END
LET T-AuditLine &
= " " ; blank line
DO INTERNAL Update-Logfile
LET T-AuditLine &
= "Completed at " &
+ ASCII(SYSDATE,8)[5:2] + "/" &
+ ASCII(SYSDATE,8)[7:2] + "/" &
+ ASCII(SYSDATE,8)[1:4] + " " &
+ ASCII(SYSTIME,8)[1:2] + ":" &
+ ASCII(SYSTIME,8)[3:2] + ":" &
+ ASCII(SYSTIME,8)[5:2] + ":" &
+ ASCII(SYSTIME,8)[7:2]
DO INTERNAL Update-Logfile
LET T-AuditLine &
= " Records Read " &
+ ASCII(T-RecordsRead)
DO INTERNAL Update-Logfile
LET T-AuditLine &
= " Records Processed " &
+ ASCII(T-RecordsProcessed)
DO INTERNAL Update-Logfile
LET T-AuditLine &
= " Records Updated " &
+ ASCII(T-RecordsUpdated)
DO INTERNAL Update-Logfile
RETURN
END
From: Michael Cousins [mailto:Michael.Cousins at ca.ibm.com]
Sent: January 13, 2010 9:49 AM
To: Ken at Langendock.com
Subject: [Bulk] Re: Quick in Batch directing info statements to a log file
APPEND on the DESIGNER file. I think the default access does not move the record pointer on a DESIGNER file. Been too long to be sure.
You could also use a DEFINE to build a string to be executed from a RUN COMMAND statement.
DEFINE AUDITREC CHAR SIZE 80 = "ECHO Read " &
+ RecordNo OF ecb100da + "/" &
+ LineNo OF ecb100da &
+ " >> myauditfile"
PROCEDURE INITIALIZE
BEGIN
WHILE RETRIEVING ecb100da & ; detail records
SEQUENTIAL
BEGIN
RUN COMMAND AUDITREC
DO INTERNAL Process-This-Record
END
RETURN
END
/mc
Michael Cousins
Global Response Team
IBM Software Group, Information Management
michael.cousins at ca.ibm.com
613.356.5811
From:
"Ken Langendock" <ken.langendock at rogers.com>
To:
"'PowerHouse List'" <powerh-l at lists.sowder.com>
Date:
01/13/2010 09:31 AM
Subject:
Quick in Batch directing info statements to a log file
Sent by:
powerh-l-bounces+michael.cousins=ca.ibm.com at lists.sowder.com
_____
Hello everyone
I am running PH841F (on windows) and am running a quick program in batch.
I want to spit out some info messages into a log file to be able to track this “black-box” program during a job run.
Basically the screen looks like this
SCREEN ecb100e &
MENU
FILE *ecb100da DESIGNER
PROCEDURE INITIALIZE
BEGIN
WHILE RETRIEVING ecb100da & ; detail records
SEQUENTIAL
BEGIN
INFO = "Read " &
+ RecordNo OF ecb100da + "/" &
+ LineNo OF ecb100da
DO INTERNAL Process-This-Record
END
RETURN
END
The program works, but unfortunately the output only contains the last line sent to the screen (if there was one) with a bunch of control characters. I would prefer to see all the info statements as an audit.
[H[J)0[m[37m[40m[;f[JQUICK session completed.[2;f
Anyone got any ideas?
I could create another subfile/permanent file and write to it as if it was a log file, but I thought this would be simpler and would not require any additional coding.
Ken--
= = = = = = = = = = = = = = = = = = = = = = = = = = = =
Mailing list: powerh-l at lists.sowder.com
Subscribe: 'subscribe' in message body to powerh-l-request at lists.sowder.com
Unsubscribe: 'unsubscribe <password>' in message body to powerh-l-request at lists.sowder.com
<http://lists.sowder.com/mailman/listinfo/powerh-l> http://lists.sowder.com/mailman/listinfo/powerh-l
This list is closed, thus to post to the list you must be a subscriber.
Add 'site:lists.sowder.com powerh-l' to your search terms to search the list archive at Google.
No virus found in this incoming message.
Checked by AVG - www.avg.com
Version: 9.0.725 / Virus Database: 270.14.138/2618 - Release Date: 01/13/10 02:35:00
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.sowder.com/pipermail/powerh-l/attachments/20100113/06fe11c4/attachment-0001.htm
More information about the powerh-l
mailing list