Carriage Return that works on AS/400 (IBM iSeries) server

jgrams

Member
I am looking for a business function that will put a carriage return at the end of a text line. I found B9861B (Add a Carrige Return to String), but this BSFN only works locally and not on the server (AS/400). I called in the issue to Oracle and they do not have a BSFN that does this on the server. Does anyone know of a way to code a carriage return that will work on the server?
 
Jennifer,

Have you tried using the business function below to get the character and then concatenating it to the end of your string?

Function Name: GetNewLineCharacter
Function description: Get New Line Character
Source Module: B0800207
 
Hi, I have created a BSFN for that which works fine on AS400 as well as on the WIN32 Client.
Feel free to use the attached source.
Let me know if you have any questions.

---------------------
OneWorld XE,8.9,8.10,8.12 AS400V5R4, Citrix, XPI 4.6/8.92/8.94/8.96 (webMethods 6.1/7.2)
WAS 5.0.2

web: http://www.e1itconsult.com





C-File: Start ---------------------------------------------
#include <jde.h>

#define b5998020_c


/*****************************************************************************
* Source File: b5998020
*
* Description: E1IT Get Plattform CRLF Source File
*
* History:
* Date Programmer SAR# - Description
* ---------- ---------- -------------------------------------------
* Author 16.07.04 E1IT Unknown - Created
*
* Copyright (c) J.D. Edwards World Source Company, 1996
*
* This unpublished material is proprietary to J.D. Edwards World Source Company.
* All rights reserved. The methods and techniques described herein are
* considered trade secrets and/or confidential. Reproduction or
* distribution, in whole or in part, is forbidden except by express
* written permission of J.D. Edwards World Source Company.
****************************************************************************/
/**************************************************************************
* Notes:
*
**************************************************************************/

#include <b5998020.h>


/**************************************************************************
* Business Function: E1ITGetPlattformCRLF
*
* Description: E1IT Get Plattform CRLF
*
* Parameters:
* LPBHVRCOM lpBhvrCom Business Function Communications
* LPVOID lpVoid Void Parameter - DO NOT USE!
* LPDSD5998 lpDS Parameter Data Structure Pointer
*
*************************************************************************/

JDEBFRTN (ID) JDEBFWINAPI E1ITGetPlattformCRLF (LPBHVRCOM lpBhvrCom, LPVOID lpVoid, LPDSD5998020A lpDS)

{
/************************************************************************
* Variable declarations
************************************************************************/

/************************************************************************
* Declare structures
************************************************************************/

/************************************************************************
* Declare pointers
************************************************************************/

/************************************************************************
* Check for NULL pointers
************************************************************************/
if ((lpBhvrCom == (LPBHVRCOM) NULL) ||
(lpVoid == (LPVOID) NULL) ||
(lpDS == (LPDSD5998020A) NULL))
{
jdeErrorSet (lpBhvrCom, lpVoid, (ID) 0, _J("4363"), (LPVOID) NULL);
return ER_ERROR;
}

/************************************************************************
* Set pointers
************************************************************************/

/************************************************************************
* Main Processing
************************************************************************/



/* Load cCRHex and cLFHex with Hex Characters */
/* AS400 part */
#ifdef JDENV_AS400
lpDS->cCRHex = _J('\x0D'); /* 0x0D */
lpDS->cLFHex = _J('\x25'); /* 0x25 */
lpDS->cOSType = _J('A'); /* A - AS400 */
#endif

/* Non AS400 part */
#ifndef JDENV_AS400
/*lpDS->cCRHex = '\r'; /* 0x0D */
/*lpDS->cLFHex = '\n'; /* 0x0A */
lpDS->cCRHex = _J('\x0D'); /* 0x0D */
lpDS->cLFHex = _J('\x0A'); /* 0x0A */
lpDS->cOSType = _J('W'); /* W -Win */
#endif








/************************************************************************
* Function Clean Up
************************************************************************/

return (ER_SUCCESS);
}

/* Internal function comment block */
/**************************************************************************
* Function: Ixxxxxxx_a // Replace "xxxxxxx" with source file number
* // and "a" with the function name
* Notes:
*
* Returns:
*
* Parameters:
**************************************************************************/
C-File: END ---------------------------------------------


H-File: Start ---------------------------------------------

/*****************************************************************************
* Header File: B5998020.h
*
* Description: E1IT Get Plattform CRLF Header File
*
* History:
* Date Programmer SAR# - Description
* ---------- ---------- -------------------------------------------
* Author 16.07.04 E1IT Unknown - Created
*
*
* Copyright (c) J.D. Edwards World Source Company, 1996
*
* This unpublished material is proprietary to J.D. Edwards World Source
* Company. All rights reserved. The methods and techniques described
* herein are considered trade secrets and/or confidential. Reproduction
* or distribution, in whole or in part, is forbidden except by express
* written permission of J.D. Edwards World Source Company.
****************************************************************************/

#ifndef __B5998020_H
#define __B5998020_H

/*****************************************************************************
* Table Header Inclusions
****************************************************************************/

/*****************************************************************************
* External Business Function Header Inclusions
****************************************************************************/

/*****************************************************************************
* Global Definitions
****************************************************************************/

/*****************************************************************************
* Structure Definitions
****************************************************************************/

/*****************************************************************************
* DS Template Type Definitions
****************************************************************************/
/*****************************************
* TYPEDEF for Data Structure
* Template Name: E1IT Get Plattform CRLF
* Template ID: D5998020A
* Generated: Fri Jul 16 06:07:17 2004
*
* DO NOT EDIT THE FOLLOWING TYPEDEF
* To make modifications, use the OneWorld Data Structure
* Tool to Generate a revised version, and paste from
* the clipboard.
*
**************************************/

#ifndef DATASTRUCTURE_D5998020A
#define DATASTRUCTURE_D5998020A

typedef struct tagDSD5998020A
{
JCHAR cCRHex;
JCHAR cLFHex;
JCHAR cOSType;
} DSD5998020A, *LPDSD5998020A;

#define IDERRcCRHex_1 1L
#define IDERRcLFHex_2 2L
#define IDERRcOSType_3 3L

#endif
/*****************************************************************************
* Source Preprocessor Definitions
****************************************************************************/
#if defined (JDEBFRTN)
#undef JDEBFRTN
#endif

#if defined (WIN32)
#if defined (WIN32)
#define JDEBFRTN(r) __declspec(dllexport) r
#else
#define JDEBFRTN(r) __declspec(dllimport) r
#endif
#else
#define JDEBFRTN(r) r
#endif

/*****************************************************************************
* Business Function Prototypes
****************************************************************************/
JDEBFRTN (ID) JDEBFWINAPI E1ITGetPlattformCRLF (LPBHVRCOM lpBhvrCom, LPVOID lpVoid, LPDSD5998020A lpDS);


/*****************************************************************************
* Internal Function Prototypes
****************************************************************************/

#endif /* __B5998020_H */

H-File: END ---------------------------------------------
 

Attachments

  • 144486-B5998020.zip
    2.4 KB · Views: 117
Copy a String to Windows Clipboard from an Application

Hello!
Have you been asked to custom an application and copy a string into Windows Clipboard? I Have been! I have thought adding that code in a BF under E1 8.10 8.95
but i am noob enough not to be able to use the window handle, any idea?

<font class="small">Code:</font><hr /><pre> 4.//-----------------------------------------------------------------------------
5.// Object: manage windows clipboard
6.//-----------------------------------------------------------------------------
7.
8.#include "clipboard.h"
9.
10.//-----------------------------------------------------------------------------
11.// Name: CopyToClipboard
12.// Object: This function paste string inside clipboard
13.// Parameters :
14.// in : HWND hWindow : window handle
15.// TCHAR* szData : data to copy
16.// out :
17.// return : TRUE on success
18.//-----------------------------------------------------------------------------
19.BOOL CClipboard::CopyToClipboard(HWND hWindow,TCHAR* szData)
20.{
21. LPTSTR lptstrCopy;
22. HGLOBAL hglbCopy;
23.
24. if (IsBadReadPtr(szData, sizeof(TCHAR)))
25. return FALSE;
26.
27. if (!OpenClipboard(hWindow))
28. {
29. CAPIError::ShowLastError(CClipboard_ERROR_COPYING_DATA);
30. return FALSE;
31. }
32. EmptyClipboard();
33.
34. // Allocate a global memory object for the text.
35. hglbCopy = GlobalAlloc(GMEM_MOVEABLE,(_tcslen(szData)+1)*sizeof(TCHAR));
36. if (!hglbCopy)
37. {
38. CloseClipboard();
39. CAPIError::ShowLastError(CClipboard_ERROR_COPYING_DATA);
40. return FALSE;
41. }
42.
43. // Lock the handle and copy the text to the buffer.
44. lptstrCopy = (LPTSTR)GlobalLock(hglbCopy);
45. if (!lptstrCopy)
46. {
47. CloseClipboard();
48. GlobalFree(hglbCopy);
49. CAPIError::ShowLastError(CClipboard_ERROR_COPYING_DATA);
50. return FALSE;
51. }
52. // copy data and ending null char
53. memcpy(lptstrCopy, szData, (_tcslen(szData)+1)*sizeof(TCHAR));
54. // unlock handle
55. GlobalUnlock(hglbCopy);
56.
57. // Place the handle on the clipboard.
58. if (!SetClipboardData(
59.#if (defined(UNICODE)||defined(_UNICODE))
60. CF_UNICODETEXT,
61.#else
62. CF_TEXT,
63.#endif
64. hglbCopy))
65. {
66. CAPIError::ShowLastError(CClipboard_ERROR_COPYING_DATA);
67. CloseClipboard();
68. GlobalFree(hglbCopy);
69. return FALSE;
70. }
71. CloseClipboard();
72.
73. // Don't free memory with GlobalFree(hglbCopy); in case of SetClipboardData success
74. // Windows do it itself at the next EmptyClipboard(); call
75.
76. return TRUE;
77.}
</pre><hr />
 
Back
Top Bottom