Ken: Dunno if attachments work on the mailing list but here is the method. It includes a bunch of stuff dealing with masking credit card holder data that you will want to ignore. FWIW, it's not very elegant but it works.
Regards, Scott Ramey BDS Software > -----Original Message----- > From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf > Of Ken Dibble > Sent: Wednesday, April 18, 2007 10:20 AM > To: [email protected] > Subject: RE: Printing Synchronization Problem > > Hmmmmm... interesting. > Just a couple of thoughts > 1. Is it possible the reporting class is grabbing the semaphore file > before > it printing.exe has populated it? > > Nope, the semaphore file is destroyed by the main program's printing class > immediately after a value is retrieved from it. It is not recreated until > the printing .exe is run again and generates a return value. > > 2. As a debugging aid I have a method/function that writes a trace file > (FWRITE to a plain text file) with whatever debugging information may be > useful at that point. You might sprinkle something like this all around > in > your reporting class and printing.exe to try and get a better idea what's > happening. If you're interested I can send you a copy of the function. > > Thank you. I'd like to see it if you still want to send it after you read > the rest of this message. <g> > * * Sample calls: * This.WriteMessageToLogFile( "N", PROGRAM() + " - " + STR( LINE(), = 4, 0 ) + " lnResult=3D" + ALLTRIM(STR(lnResult,11,0)) + " <<<--- Trace" = ) * This.WriteMessageToLogFile( "N", PROGRAM() + " - " + STR( LINE(), = 4, 0 ) + " lhFTPSession=3D" + ALLTRIM(STR(lhFTPSession,11,0)) * This.WriteMessageToLogFile( "S", pc_MessageToSend ) * FUNCTION WriteMessageToLogFile PARAMETERS pc_SentOrReceived, pc_Message LOCAL lnLogFileHandle, lcSentOrReceived, lcMessage, lcDateTime, = lcLogFileEntry, lnTraceFileSize, ; lcAuthRequestHeader, ln2nd_FS_char, ln3rd_FS_char, lnPos_B, = lnPos_C, lnPos_D, lnPos_E, lnPos_H, ; lcMsgPart1, lcMsgPart2, lcMsgPart3, lcNewMsg, ; lnPos_G, lnLen_GH, ln4th_FS_char, lcCATagLoc, lcCBTagLoc, = lnCBdataStart, lnCBdataLen ************** = *************************************************************************= ******* * 11/08/2006 * * Additional initialization of local memvars to avoid = some VFP errors ************** = *************************************************************************= ******* lcAuthRequestHeader =3D SPACE(01)=20 lcCATagLoc =3D SPACE(01)=20 lcCBTagLoc =3D SPACE(01)=20 lcDateTime =3D SPACE(01)=20 lcLogFileEntry =3D SPACE(01)=20 lcMessage =3D SPACE(01)=20 lcMsgPart1 =3D SPACE(01)=20 lcMsgPart2 =3D SPACE(01)=20 lcMsgPart3 =3D SPACE(01)=20 lcNewMsg =3D SPACE(01)=20 lcSentOrReceived =3D 0000=20 ln2nd_FS_char =3D 0000=20 ln3rd_FS_char =3D 0000=20 ln4th_FS_char =3D 0000=20 lnCBdataLen =3D 0000=20 lnCBdataStart =3D 0000=20 lnLen_GH =3D 0000=20 lnLogFileHandle =3D 0000=20 lnLogFileHandle =3D 0000 lnPos_B =3D 0000=20 lnPos_C =3D 0000=20 lnPos_D =3D 0000=20 lnPos_E =3D 0000=20 lnPos_G =3D 0000 =20 lnPos_H =3D 0000=20 lnTraceFileSize =3D 0000 IF FILE( This.LogFileName ) lnLogFileHandle =3D FOPEN( This.LogFileName, 11 ) ELSE lnLogFileHandle =3D FCREATE( This.LogFileName ) ENDIF IF lnLogFileHandle < 1 RETU( .F. ) ENDIF DO CASE CASE UPPER( LEFT( pc_SentOrReceived, 1 ) ) =3D "S" lcSentOrReceived =3D "SENT: " CASE UPPER( LEFT( pc_SentOrReceived, 1 ) ) =3D "R" lcSentOrReceived =3D "RCVD: " CASE UPPER( LEFT( pc_SentOrReceived, 1 ) ) =3D "N" lcSentOrReceived =3D "" OTHERWISE lcSentOrReceived =3D "????: " ENDCASE lcAuthRequestHeader =3D This.gc_STX + "P`" + This.gc_FS ln3rd_FS_char =3D 00 ln2nd_FS_char =3D 00 ************** = *************************************************************************= ******* * 11/08/2006 * * Look for the beginning and ending of the cvv data, = which needs to be masked ************** = *************************************************************************= ******* lcca_tag =3D This.gc_FS + "ca" =20 lncb_tag =3D This.gc_FS + "cb" lcCATagLoc =3D 00 lcCBTagLoc =3D 00 lcMessage =3D pc_Message IF LEFT( lcMessage, 4 ) =3D=3D lcAuthRequestHeader ln2nd_FS_char =3D AT( This.gc_FS, lcMessage, 2 ) ln3rd_FS_char =3D AT( This.gc_FS, lcMessage, 3 ) ln4th_FS_char =3D AT( This.gc_FS, lcMessage, 4 ) lcCATagLoc =3D AT( lcca_tag, lcMessage, 1 ) lcCBTagLoc =3D AT( lncb_tag, lcMessage, 1 ) IF ln3rd_FS_char > ln2nd_FS_char AND ln3rd_FS_char <> 0 ************** = *************************************************************************= ******* * 11/08/2006 * * Modified this IF statement and dependent = code to also mask the expiration date ************** = *************************************************************************= ******* = *************************************************************************= *** * Rebuild lcMessage. * Part 1 =3D Up through first FS character * Part 2 =3D *'s up to last four char of card number * Part 3 =3D remainder of message = *************************************************************************= *** ** = [STX]P`[FS]301322033336302[FS]c371513957151007[FS]0307[FS]fC[FS]a33. . = .[ETX] ** A B C DE F G = H ** 1 4 5 15 20 = 48 lnPos_B =3D ln2nd_FS_char lnPos_C =3D ln2nd_FS_char + 2 && have to skip over the 'c' = token character lnPos_D =3D ln3rd_FS_char - 5 lnPos_E =3D ln3rd_FS_char - 4 lnPos_G =3D ln3rd_FS_char + 5 lnPos_H =3D LEN( lcMessage ) lnlen_CD =3D ( lnPos_D - lnPos_C ) + 1 lnlen_EH =3D ( lnPos_H - lnPos_E ) + 1 lnLen_GH =3D ( lnPos_H - lnPos_G ) + 1 IF lnlen_CD > 5 lcMsgPart1 =3D LEFT( lcMessage, lnPos_B + 1 ) && add 1 = to include the 'c' token character lcMsgPart2 =3D REPLICATE( "*", lnlen_CD ) + SUBSTR( = lcMessage, ln3rd_FS_char -4, 4 ) + This.gc_FS + "****" lcMsgPart3 =3D RIGHT( lcMessage, lnLen_GH ) lcNewMsg =3D lcMsgPart1 + lcMsgPart2 + lcMsgPart3 lcMessage =3D lcNewMsg ENDIF ENDIF ************** = *************************************************************************= ******* * 11/08/2006 * * Added this portion to mask the CVV data field. * 11/08/2006 * * If the sequence of tags ever changes these = routines will have to be changed ************** = *************************************************************************= ******* IF lcCBTagLoc > lcCATagLoc AND lcCATagLoc <> 0 lnCBdataStart =3D lcCATagLoc + 3 lnCBdataLen =3D lcCBTagLoc - lnCBdataStart lcMsgPart1 =3D LEFT( lcMessage, lcCATagLoc - 1 ) lcMsgPart2 =3D This.gc_FS + "ca" + REPLICATE( "*", = lnCBdataLen ) lcMsgPart3 =3D RIGHT( lcMessage, LEN( lcMessage ) - ( = lcCBTagLoc - 1 ) ) lcNewMsg =3D lcMsgPart1 + lcMsgPart2 + lcMsgPart3 lcMessage =3D lcNewMsg ENDIF ENDIF = *************************************************************************= ************ * End of checking message to see if it is an auth request = *************************************************************************= ************ lcMessage =3D STRTRAN( lcMessage, This.gc_NUL, "[NUL]" ) && 00 lcMessage =3D STRTRAN( lcMessage, This.gc_SOH, "[SOH]" ) && 01 lcMessage =3D STRTRAN( lcMessage, This.gc_STX, "[STX]" ) && 02 lcMessage =3D STRTRAN( lcMessage, This.gc_ETX, "[ETX]" ) && 03 lcMessage =3D STRTRAN( lcMessage, This.gc_EOT, "[EOT]" ) && 04 lcMessage =3D STRTRAN( lcMessage, This.gc_ENQ, "[ENQ]" ) && 05 lcMessage =3D STRTRAN( lcMessage, This.gc_ACK, "[ACK]" ) && 06 lcMessage =3D STRTRAN( lcMessage, This.gc_BEL, "[BEL]" ) && 07 lcMessage =3D STRTRAN( lcMessage, This.gc_BS , "[BS ]" ) && 08 lcMessage =3D STRTRAN( lcMessage, This.gc_HT , "[HT ]" ) && 09 lcMessage =3D STRTRAN( lcMessage, This.gc_LF, "[LF]" ) && 10 lcMessage =3D STRTRAN( lcMessage, This.gc_CR, "[CR]" ) && 13 lcMessage =3D STRTRAN( lcMessage, This.gc_SO, "[SO]" ) && 14 lcMessage =3D STRTRAN( lcMessage, This.gc_SI, "[SI]" ) && 15 lcMessage =3D STRTRAN( lcMessage, This.gc_DLE, "[DLE]" ) && 16 lcMessage =3D STRTRAN( lcMessage, This.gc_XON, "[XON]" ) && 17 lcMessage =3D STRTRAN( lcMessage, This.gc_DC2, "[DC2]" ) && 18 lcMessage =3D STRTRAN( lcMessage, This.gc_DC3, "[DC3]" ) && 19 lcMessage =3D STRTRAN( lcMessage, This.gc_XOFF,"[XOF]" ) && 19 lcMessage =3D STRTRAN( lcMessage, This.gc_DC4, "[DC4]" ) && 20 lcMessage =3D STRTRAN( lcMessage, This.gc_NAK, "[NAK]" ) && 21 lcMessage =3D STRTRAN( lcMessage, This.gc_SYN, "[SYN]" ) && 22 lcMessage =3D STRTRAN( lcMessage, This.gc_ETB, "[ETB]" ) && 23 lcMessage =3D STRTRAN( lcMessage, This.gc_CAN, "[CAN]" ) && 24 lcMessage =3D STRTRAN( lcMessage, This.gc_EM, " [EM]" ) && 25 lcMessage =3D STRTRAN( lcMessage, This.gc_SUB, "[SUB]" ) && 26 lcMessage =3D STRTRAN( lcMessage, This.gc_ESC, "[ESC]" ) && 27 lcMessage =3D STRTRAN( lcMessage, This.gc_FS, "[FS]" ) && 28 lcMessage =3D STRTRAN( lcMessage, This.gc_GS, "[GS]" ) && 29 lcMessage =3D STRTRAN( lcMessage, This.gc_RS, "[RS]" ) && 30 lcMessage =3D STRTRAN( lcMessage, This.gc_US, "[US]" ) && 31 lcDateTime =3D DTOC( date() ) + " " + TIME() + RIGHT(ALLTRIM( STR( = SECONDS(), 12, 3 ) ), 4 ) + " " lcLogFileEntry =3D lcDateTime + lcSentOrReceived + lcMessage lnTraceFileSize =3D FSEEK( lnLogFileHandle, 0, 2 ) && put to EOF & = get file size FPUTS( lnLogFileHandle, lcLogFileEntry ) FCLOSE( lnLogFileHandle ) RETURN( .T. ) --- StripMime Report -- processed MIME parts --- multipart/mixed text/plain (text body -- kept) text/plain (text body -- kept) --- _______________________________________________ Post Messages to: [email protected] Subscription Maintenance: http://leafe.com/mailman/listinfo/profox OT-free version of this list: http://leafe.com/mailman/listinfo/profoxtech Searchable Archive: http://leafe.com/archives/search/profox This message: http://leafe.com/archives/byMID/profox/[EMAIL PROTECTED] ** All postings, unless explicitly stated otherwise, are the opinions of the author, and do not constitute legal or medical advice. This statement is added to the messages for those lawyers who are too stupid to see the obvious.

