Scott,
if you use this just once a day there is no added value to keep the connection up.
It's rather the risk that some piece in between terminates it and triggers an error on your side.
With any value other -1 you disconnect or get disconnected but it's no error but expected behavior
http://docs.intersystems.com/latest/csp/docbook/DocBook.UI.Page.cls?KEY=ETCP_settings_outbound#ETCP_C220762

Sorry to be late. I was busy today:

Thanks to  @Eduard Lebedyuk

I did it in a traditional one-liner: 79  77 char.   + 4 char extra to read the size.

I'll wrap it into a method later to see how much waste of space this generates. devil

5 min. later:
OK. Method consumes 3 char. extra {} to enclose it + blank at the start   =>>> 82   80  ~3.9% overhead

s=1...4 looks odd but it improves.

f j=1:1:15 zw j d ##class(DC.size).main(j) 

j=1
#
j=2
##
##
j=3
###
###
###
j=4
####
####
####
####
j=5
#####
## ##
# # #
## ##
#####
j=6
######
##  ##
# ## #
# ## #
##  ##
######
j=7
#######
##   ##
# # # #
#  #  #
# # # #
##   ##
#######
j=8
########
##    ##
# #  # #
#  ##  #
#  ##  #
# #  # #
##    ##
########

Evgeny,

My SAMPLES has no listing 'Custom Listing' in HoleFoods

But this works:

SAMPLES>d $SYSTEM.DeepSee.Shell()
DeepSee Command Line Shell
----------------------------------------------------
Enter q to quit, ? for help. 
>>DRILLTHROUGH SELECT FROM [HoleFoods] %LISTING [Customer Info]
 
   #  ID        Store Loc Country   Product   Customer  Latitude  Longitude
   1: 1         Tokyo     Japan    
Free-rang
   2: 2         Shanghai  China     Lifesaver
   3: 3         Sao Paolo Brasil    Onion rin
   4: 4         Paris     France    Ziti (box
   5: 5         Santiago  Chile     Donuts (d
   6: 6         Brasilia  Brasil    Ziti (box
   7: 7         Madrid    Spain     Donuts (d
   8: 8         Chicago   USA      
Tortellin 46168     39.716036 -86.39506
   9: 9         Frankfurt Germany   Swiss Che
  10: 10        Tokyo     Japan     Onion rin

similar:

 >>DRILLTHROUGH SELECT FROM [Patients] %LISTING [Custom SQL listing]
 
   #  PatientID      FavoriteColor
   1: SUBJ_100301    Green
   2: SUBJ_100302    Orange
   3: SUBJ_100303    Yellow
   4: SUBJ_100305    Orange
   5: SUBJ_100306    Purple
   6: SUBJ_100307    Orange
   7: SUBJ_100308    Blue

There is no default %PCL.int as mnemonics for PCL printing in Caché.
So according to the link

http://docs.intersystems.com/latest/csp/docbook/DocBook.UI.Page.cls?KEY=GIOD_intro#GIOD_intro_definemnemomic

you have to write it yourself.

But before this interesting exercise find a document on the control codes for your "low-end HP laser printer and a Brother laser"

Your description is just to vague to google for it. you depend on the type an level of PCL.
I tried and got 2.46 million hits on bold printing for Brother Laser.
This one looked useful but I didn't read all 531 pages and I don't know your printer version.
https://www.brother.com.au/pdf/support/controlcodes/PCL_Tech_Manual.pdf

This looked most useful:

5.2.11. Selecting the stroke weight
Esc(s#B (27)(40)(115)#(66) <1Bh><28h><73h>#<42h>
 This command designates the stroke weight of the primary font.
Esc)s#B (27)(41)(115)#(66) <1Bh><29h><73h>#<42h>
 This command designates the stroke weight of the secondary font
 # is an integer between –7 and 7. A value of 0 signifies a medium stroke weight, negative numbers signify
thin or light stroke weights and positive numbers signify bold stroke weights.
 If you select a light or bold stroke weight the command will only have an effect if the font is available in one of the three font locations.

that means you should try first if your printer is covered:

set bold1on=$c(27,40,115)_7_$c(66)
set bold2on=$c(27,41,115)_7_$c(66)
set bold1off=$c(27,40,115)_0_$c(66)
set bold2off=$c(27,41,115)_0_$c(66)
;; let's test it

open prt use prt  write #
     
write !,"test1 " , bold1on, "text with bold1on ", bold1off, "text with bold1off",!
     write !,"test2 " , bold2on, "text with bold2on ", bold2off, "text with bold12off",!

write # close prt

from the description, it is not clear if 7 and 0 are characters or if this are binaries.
you may need to replace it with $c(7) and $c(0). 

once you know the codes you may decide how to make use of it. 

 

ok

• property Identifier as %String [ Calculated,Transient,ReadOnly ];
http://docs.intersystems.com/latest/csp/documatic/%25CSP.Documatic.cls?PAGE=CLASS&LIBRARY=ENSLIB&CLASSNAME=EnsLib.HL7.Message#PROPERTY_Identifier

Unique document identification string found at MSH:10 / MessageControlId in document content

You can't set it. It gets calculated and is ReadOnly.

Following http://docs.intersystems.com/latest/csp/documatic/%25CSP.Documatic.cls?PAGE=CLASS&LIBRARY=ENSLIB&CLASSNAME=EnsLib.HL7.Message
you should probably start  with

     set Set HL7Msg=##class(EnsLib.HL7.Message).%New()
 and start to compose the message accordingly.

If you didn't correct the other 2 mistakes it's no surprise.

The code should look like this:

 set tSC=$$$OK
 set ^tvalue=1
 set ^tvalue=$INCREMENT(^tvalue)
 
    #dim rs as EnsLib.SQL.GatewayResultSet
    #dim reStream as %Stream.GlobalCharacter
    if $$$ISERR(pRequest) quit pRequest
    set sc=..Adapter.ExecuteQuery(.rs,..GetTheSubmissionData(pRequest.pMonth, pRequest.pApp, pRequest.pRef, pRequest.pInPat))
   
    if $$$ISERR(sc) quit sc
  
   
set reStream=##class(%Stream.GlobalCharacter).%New()
    while rs.Next() {
        set (comma,rec)=""
        for i=1:1:rs.GetColumnCount() {
            set rec=rec_comma_""""_rs.GetData(i)_""""
            set comma=","   
        }
     ;;   set reStream=""   ;; dont kill your stream before using !!! OMG
        set sc=reStream.WriteLine(rec)
        
    }
    do reStream.%Save()

     ;; sc doesn't reflect if there is a content in reStream. check Size instead
   set sc=''reStream.Size

       
       if ($$$ISOK(sc))set pResponse.pReqDetails=reStream
           set reStream=""
        
else {$$$TRACE("There is nothing on the stream")
    
     set tSC=pResponse.%Save()
      
 set tSC=..SendRequestSync(..TargetConfigNames,pResponse,.pOutput)
 Quit tSC

 

Checking some hints for  SMTP.office365.com
https://answers.microsoft.com/en-us/msoffice/forum/msoffice_o365admin-mso_dep365/smtpoffice365com-relay-535-573-authentication/9de8d176-1c07-4e66-b14f-148d3bd51bbf

I see that the require SSL/TLS encryption.

In your code I miss
     Set server.SSLConfiguration = "whatever you named it

This might most likely cause the problem.
 

In anticipation of your next post:  How to setup SSL/TLS configuration.
http://docs.intersystems.com/latest/csp/docbook/DocBook.UI.Page.cls?KEY=GCAS_ssltls#GCAS_ssltls_createedit
 

If DATA and CODE are separated then taking over CACHE.DAT from a final test environment could be an option.

But as the default for a namespace is DATA+CODE  and this is widely spread also in large applications in
real environments recompiling is the only possibility. Many years back even a special change was implemented in
Caché to support compiling during runtime of the code.

I personally dislike both and fought for clear separation of CODE from DATA. With very limited success.sad

I Googled just a few notes:
GE Healthcare to Acquire IDX Systems Corporation  (2005)
https://www.businesswire.com/news/home/20050929005340/en/GE-Healthcare-Acquire-IDX-Systems-Corporation-Significantly

and  wiki tells me it runs on Caché:
https://en.wikipedia.org/wiki/IDX_Systems

But this doesn't tell us how it communicates with users and external devices.
Caché is definitely not blocking a move to Linux. 
C++ based connections may prevent it if you don't have the sources and a lot of experience to test and debug it.
Eventually, other members of the developers' society have more detailed insight.

But I think GE should know it.