Highlighted
Outstanding Contributor.
Outstanding Contributor.
666 views

More translate C# to COBOL

Jump to solution

Hello,

I need one more help converting these instructions from C # to Cobol.

The purpose of the code is to send the ZPLString string to a printer where the IP is ipAddress.

 

// Printer IP Address and communication port
string ipAddress = "10.3.14.42";
int port = 9100;
 
// ZPL Command(s)
string ZPLString =
    "^XA" +
    "^FO50,50" +
    "^A0N50,50" +
    "^FDHello, World!^FS" +
    "^XZ";
 
try
{
    // Open connection
    System.Net.Sockets.TcpClient client = new System.Net.Sockets.TcpClient();
    client.Connect(ipAddress, port);
 
    // Write ZPL String to connection
    System.IO.StreamWriter writer =
new System.IO.StreamWriter(client.GetStream());
    writer.Write(ZPLString);
    writer.Flush();
 
    // Close Connection
    writer.Close();
    client.Close();
}
catch (Exception ex)
{
    // Catch Exception
}
 
 
That's what I'm missing to finish the access control project.
 
Best regards.
Alberto Ferraz
Tags (1)
0 Likes
1 Solution

Accepted Solutions
Highlighted
Outstanding Contributor.
Outstanding Contributor.

RE: More translate C# to COBOL

Jump to solution
I've already been able to convert the code to Cobol and the process is already working.
Thank you.

Best Regards
Alberto Ferraz

View solution in original post

1 Reply
Highlighted
Outstanding Contributor.
Outstanding Contributor.

RE: More translate C# to COBOL

Jump to solution
I've already been able to convert the code to Cobol and the process is already working.
Thank you.

Best Regards
Alberto Ferraz

View solution in original post

The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.