Problem d'appel d'un prog. cobol via Java
Bonjour ,
Je veux appler un programme cobol qui tourne sous l'as/400 a travers le language Java . Je me suis basé sur ce lien .
voici mon prog Java :
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84
| package com.as400.esquif.cobol;
import com.ibm.as400.data.ProgramCallDocument;
import com.ibm.as400.data.PcmlException;
import com.ibm.as400.access.AS400;
import com.ibm.as400.access.AS400Exception;
import com.ibm.as400.access.AS400Message;
import com.portail.esquif.bd.ConnexionAS400;
// Example class to call an COBOL program to add two numbers and return the sum
public class CallCOBOLPGMAS400 {
public CallCOBOLPGMAS400() {
}
public static void main(String argv[]) throws AS400Exception {
AS400 sys;
// Create and instantiate an AS/400 Object
// If you do not enter a user id or password, you will be prompted for
// each
// AS400 sys = new AS400("url of iSeries", "user id", "password");
System.out.println("Connecting to iSeries...");
sys = new AS400("GEDAMO", "admin123", "aecafv2", "2.2.0.20");
// Create Data Objects
ProgramCallDocument pcml; // com.ibm.as400.data.ProgramCallDocument
String myresponse; // COBOLprogram variable
boolean rc = false; // Return code for program call
String msgId, msgText; // Messages returned from AS/400
try {
// Instantiate the Objects (assign the variables)
pcml = new ProgramCallDocument(sys, "ExamplePcml");
//pcml.setValue("L470SPV0.L470S-PARAMETRES", new String("0112293697812293697801010110201072011011020111611201115"));
pcml.setValue("L470SPV0.L470S-PARAMETRES", new String("0"));
// pcml.setValue("program.myrep", new String(""));
// Debug statement...Use to view outbound and inbound parms if you
// need it
// com.ibm.as400.data.PcmlMessageLog.setTraceEnabled(true);
// Call the Program
System.out.println("Calling the program...");
rc = pcml.callProgram("L470SPV0");
// If return code is false, get messages from the iSeries
if (rc == false) {
// Retrieve list of AS/400 messages
AS400Message[] msgs = pcml.getMessageList("L470SPV0");
// Loop through all messages and write them to standard output
for (int m = 0; m < msgs.length; m++) {
msgId = msgs[m].getID();
msgText = msgs[m].getText();
System.out.println(" " + msgId + " - " + msgText);
}
System.out
.println("Call to L470SPV0 failed. See messages listed above");
System.exit(0);
}
// Return code was true, call to PROGRAM succeeded - woo-hoo!
else {
// Process the returned Data
myresponse = (String) pcml.getValue("L470SPV0.myname");
System.out.println("Reponse ..." + myresponse);
}
}
catch (PcmlException e) {
System.out.println(e.getLocalizedMessage());
e.printStackTrace();
System.out.println("Call to L470SPV0 failed");
System.exit(0);
}
// Disconnect from AS/400
sys.disconnectAllServices();
}
} |
Mon fichier PCML
Code:
1 2 3 4 5
| <pcml version="1.0">
<program name="L470SPV0" path="/QSYS.LIB/AECAPV2.LIB/L470SPV0.PGM">
<data name="L470S-PARAMETRES" type="char" length="400" usage="inputoutput"/>
</program>
</pcml> |
Zone d'echange Cobol :
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72
| 01 L470S-PARAMETRES. 06/07/06
1400 02 L470S-ENTREE. 06/07/06
1500 * Site M 26/03/01
1600 05 L470S-SIT PIC X(02). 06/07/06
1700 * Adhérent M 26/03/01
1800 05 L470S-ADH PIC X(13). 06/07/06
1900 * N° RO M 26/03/01
2000 05 L470S-RO1 PIC X(13). 06/07/06
2100 05 L470S-CR1 PIC X(02). 06/07/06
2200 * Rang M 26/03/01
2300 05 L470S-RNG PIC X(02). 06/07/06
2400 * Date des soins SSAAMMJJ M 26/03/01
2500 05 L470S-DSOINS PIC 9(08). 06/07/06
2600 * Date des soins SSAAMMJJ M 26/03/01
2700 05 L470S-FSOINS PIC 9(08). 06/07/06
2800 * Date du jour M 26/03/01
2900 05 L470S-DATJOUR PIC 9(08). 06/07/06
3000 CA018 * code client M 06/02/06
3100 CA018 05 L470S-CODCLI PIC X(02). 06/07/06
3200 CA018 * Filler ENTREE (A décrémenter si ajout de zones) M 06/02/06
3300 CA018 05 L470S-FILLER-E PIC X(60). 06/07/06
3400 * M 06/02/06
3500 * Anomalies codes retour 26/03/01
3600 02 L470S-RETOUR. 06/07/06
3700 * Code d'erreur 26/03/01
3800 05 L470S-ANO PIC X(10). 06/07/06
3900 * Infos ESPBEN/ESPHRO 26/03/01
4000 05 L470S-BEN. 06/07/06
4100 10 L470S-NAI PIC S9(8). 06/07/06
4200 10 L470S-LIE PIC X(1). 06/07/06
4300 10 L470S-SEX PIC X(1). 06/07/06
4400 10 L470S-ASS PIC X(1). 06/07/06
4500 10 L470S-SOC PIC X(3). 06/07/06
4600 10 L470S-DRO PIC S9(8). 06/07/06
4700 10 L470S-FRO PIC S9(8). 06/07/06
4800 10 L470S-MRO PIC X(2). 06/07/06
4900 10 L470S-RG1 PIC X(2). 06/07/06
5000 10 L470S-CA1 PIC X(3). 06/07/06
5100 10 L470S-CE1 PIC X(4). 06/07/06
5200 10 L470S-RE1 PIC X(3). 06/07/06
5300 10 L470S-DA1 PIC S9(8). 06/07/06
5722WDS V5R4M0 060210 LISTE SOURCE SEU 20/10/11 09:43:55 FRTLR401 PAGE 2
FICHIER SOURCE . . . . . AE40SV2/COPYCBL
MEMBRE . . . . . . . . . L470SWV0
SEQNBR*...+... 1 ...+... 2 ...+... 3 ...+... 4 ...+... 5 ...+... 6 ...+... 7 ...+... 8 ...+... 9 ...+... 0
5400 10 L470S-RO2 PIC X(13). 06/07/06
5500 10 L470S-CR2 PIC X(02). 06/07/06
5600 10 L470S-RG2 PIC X(2). 06/07/06
5700 10 L470S-CA2 PIC X(3). 06/07/06
5800 10 L470S-CE2 PIC X(4). 06/07/06
5900 10 L470S-RE2 PIC X(3). 06/07/06
6000 10 L470S-DA2 PIC S9(8). 06/07/06
6100 10 L470S-CC1 PIC X(1). 06/07/06
6200 10 L470S-CC2 PIC X(1). 06/07/06
6300 10 L470S-SAG PIC X(2). 06/07/06
6400 10 L470S-QUA PIC X(1). 06/07/06
6500 10 L470S-FPO PIC S9(8). 06/07/06
6600 * motif blocage prestations bénéficiaire 26/03/01
6700 10 L470S-MBP PIC X(2). 06/07/06
6800 10 L470S-ECT PIC X(1). 06/07/06
6900 * statut RO (N/S/T) 26/03/01
7000 10 L470S-CRO PIC X(1). 06/07/06
7100 10 L470S-NSU PIC X(1). 06/07/06
7200 10 L470S-CSU PIC X(1). 06/07/06
7300 * date justificatif 26/03/01
7400 10 L470S-DJ1 PIC S9(8). 06/07/06
7500 10 L470S-LJU PIC X(20). 06/07/06
7600 * date justificatif 2 26/03/01
7700 10 L470S-DJ2 PIC S9(8). 06/07/06
7800 10 L470S-CJU PIC X(1). 06/07/06
7900 CA018 * Filler Sortie (A décrémenter si ajout de zones) M 06/02/06
8000 CA018 05 L470S-FILLER-S PIC X(60). |
apres l'éxecution du programme Java j'obtien le msg suivant :
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
| Connecting to iSeries...
Calling the program...
Exception in thread "main" com.ibm.as400.access.ProxyException: A connection to the proxy server cannot be established.
at com.ibm.as400.access.PxClientConnectionAdapter.openTraditional(PxClientConnectionAdapter.java:236)
at com.ibm.as400.access.PxClientConnectionAdapter.open(PxClientConnectionAdapter.java:179)
at com.ibm.as400.access.ProxyClientConnection.open(ProxyClientConnection.java:261)
at com.ibm.as400.access.PxClientConnectionAdapter.<init>(PxClientConnectionAdapter.java:66)
at com.ibm.as400.access.ProxyClientConnection.<init>(ProxyClientConnection.java:48)
at com.ibm.as400.access.AS400.loadImpl2(AS400.java:2502)
at com.ibm.as400.access.AS400.chooseImpl(AS400.java:1058)
at com.ibm.as400.access.AS400.getVRM(AS400.java:2150)
at com.ibm.as400.data.PcmlDocument.getAs400VRM(PcmlDocument.java:234)
at com.ibm.as400.data.PcmlDocNode.getAs400VRM(PcmlDocNode.java:145)
at com.ibm.as400.data.PcmlData.isSupportedAtHostVRM(PcmlData.java:969)
at com.ibm.as400.data.PcmlProgram.callProgram(PcmlProgram.java:571)
at com.ibm.as400.data.PcmlDocument.callProgram(PcmlDocument.java:461)
at com.ibm.as400.data.ProgramCallDocument.callProgram(ProgramCallDocument.java:445)
at com.as400.esquif.cobol.CallCOBOLPGMAS400.main(CallCOBOLPGMAS400.java:46) |
Est ce que vous avez une idée a propos de cette erreur .
Je vous remerciez infiniment pour votre aide .
Cordialement