Hi Mary, this may work for you. It could do with a tidy up but should put you on the correct path. You can use this for testing - https://wiki.discoverydataservice.org/index.php?title=Dummy_NHS_numbers ClassMethod ValidNHS(pNHS As %String = "", Output pFailReason) As %Boolean { IF pNHS'?10N { set pFailReason = "Num" Quit 0 } set nCheckdigit = $Extract(pNHS,10,10) set nChi9Digits = $Extract(pNHS,1,9) set nMultFact = 2 set nCalcCheckdigit = 0 for i = 9 : -1 : 1 { set nThisDigit = $Extract(nChi9Digits,i,i) set nCalcCheckdigit = nCalcCheckdigit + (nThisDigit * nMultFact) set nMultFact = nMultFact + 1 } set nCalcCheckdigit = (nCalcCheckdigit # 11) set nCalcCheckdigit = 11 - nCalcCheckdigit if (nCalcCheckdigit = 10) { set pFailReason = "ChkDig" Quit 0 } if (nCalcCheckdigit = 11) { set nCalcCheckdigit = 0 } if (nCheckdigit = nCalcCheckdigit) { set pFailReason = "" Quit 1 } Else { set pFailReason = "ChkDig match" Quit 0 } }
hopefully this is what you mean. $$$LOGINFO("this is the first line "_$c(13,10)_"this is second line"_$c(13,10)_" this is third line")
this may help
ClassMethod testCount() { s f=##class(%Stream.FileCharacter).%New() s ff="C:\CACHEDB\ATEST.xml" d f.LinkToFile(ff) s tDoc=##class(EnsLib.EDI.XML.Document).ImportFromFile(ff,,.pOutput) w pOutput,! q:pOutput'=1 s numDoc=tDoc.GetValueAt("/DocumentS/Document[*]") w "numbers of Document "_numDoc,! }