Hi Radoslaw,

I found your post about APL char and PCOMM copy/paste, because I've the same 
problem, specially with ISPF and Omegamon screens. But no solution was 
provided. After some googling and IBM's infocenter reading, I became to the 
conclusion that it was not possible, so I decided to work about it.

In the first approach I learned (not documented) that the APL attribute was in 
the EXTFIELD Plane last bit. This plane is not available for standard APIs (VB, 
Macro, ...), but yes for the HACL (Java and C). I tried C, but the API only 
compiles with MS Visual C and IBM visual studio. So I went to java. I spent two 
days until I learned that it only works if compiled with an old Java SDK 
(1.4.2). Finally I created a simple macro "[Run Applet] CopyApl.class" that 
runs the applet and assigned it to a key. 

In PCOMM 5.9, the process pcscm.exe enter in a loop and your session (TN3270) 
become very slow. I installed 5.9.7 and now works fine.

The program is not completed, it only translate a few APL chars (box drawing). 
It leaves unicode text in the system clipboard. If you're using Lotus Notes, 
paste it with Courier New font. Does not ask why i'm using (rows*cols)+1, i do 
not understand but it works. Select show console in run applet menu for 
debugging. Feedback wellcome.

Regards, Salva.

The code:

import com.ibm.eNetwork.ECL.*;
import java.awt.Toolkit;
import java.awt.datatransfer.Clipboard;
import java.awt.datatransfer.StringSelection;

public class CopyApl implements ECLAppletInterface {
        
ECLPS ps = null;
        
        public CopyApl() {
        }

        public void init(ECLSession session) {
                ps = session.GetPS();
                int rows = ps.GetSizeRows();
                int cols = ps.GetSizeCols();
                char[] bufferT = new char[(rows*cols)+1];
                char[] bufferX = new char[(rows*cols)+1];
                
                try {
                        
ps.GetScreen(bufferT,(rows*cols)+1,ECLConstants.TEXT_PLANE);
                        
ps.GetScreen(bufferX,(rows*cols)+1,ECLConstants.EXFIELD_PLANE);
                } catch (ECLErr e) { System.out.println(e.GetMsgText()); }
                
                int i;
                int col = cols;
                char c;
                String so = "";
                for(i=0;i<rows*cols;i++) {
                        if(i==col) {
                                so = so + "\n";
                                col+=cols;
                        }
                        c = bufferT[i];
                        if ((bufferX[i] & (char)0x01) == (char)0x01) {
                                switch (c) {
                                        case 's':  so = so + "\u2500"; break;
                                        case 'e':  so = so + "\u2502"; break;
                                        case '×':  so = so + "\u2502"; break;
                                        case 'E':  so = so + "\u250c"; break;
                                        case 'N':  so = so + "\u2510"; break;
                                        case 'P':  so = so + "\u252c"; break;
                                        case 'F':  so = so + "\u251c"; break;
                                        case 'G':  so = so + "\u2534"; break;
                                        case 'L':  so = so + "\u253c"; break;
                                        case 'O':  so = so + "\u2524"; break;
                                        case 'M':  so = so + "\u2518"; break;
                                        case 'D':  so = so + "\u2514"; break;
                                        case 'n':  so = so + "\u2588"; break;
                                        case 'H':  so = so + "\u00a7"; break;
                                        case '±':  so = so + "\u2192"; break;
                                        default: so = so + c; break;
                                }
                        }
                        else so = so + c;
                }
                
                System.out.print(so);
                Toolkit toolkit = Toolkit.getDefaultToolkit();
                Clipboard clipboard = toolkit.getSystemClipboard();
                StringSelection strSel = new StringSelection(so);
                clipboard.setContents(strSel, null);
                toolkit.beep();

        }

}

----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to [email protected] with the message: INFO IBM-MAIN

Reply via email to