The easiest way to declare a new line character in ESQL:
DECLARE nl CHAR;
nl = CAST(x'<code>' AS CHAR CCSID <characterset>)
In the above <code> is the code of the new line character in your system, for example 0d0a in DOS or 0a in most of the unix. <characterset> is the coded character set id of your system.
For example, in my NT system:
nl = CAST(x'0d0a' AS CHAR CCSID 437)
!!!The CCSID part is essential or otherwise WMQI will convert the code x'0d0a' to a string 0d0a instead of string <CR><LF>.
Joined: 13 May 2002 Posts: 49 Location: KLM Holland
Nyusser wrote:
DECLARE nl CHAR;
nl = CAST(x'<code>' AS CHAR CCSID <characterset>)
In the above <code> is the code of the new line character in your system, for example 0d0a in DOS or 0a in most of the unix. <characterset> is the coded character set id of your system.
As a side note <characterset> can also be extracted from the incomming message header :
InputRoot.MQMD.CodedCharSetId
so, for example :
SET nl = CAST(x'0A' AS CHAR CCSID InputRoot.MQMD.CodedCharSetId)
gives you a line feed on z/OS as wel as NT.
This way you never need to change anything if the flow is send to an other environment.
And for the really freakish, in ESQL you can also add a LF to a string this way :
SET mystr = 'Hello World' || '
';
read carefully and enjoy !
ps: I wouldn't use this last part in production code, it's a bug^H^H^HFeature.
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum