Paradox - Urgente exportar

 
Vista:

Urgente exportar

Publicado por El_maik (3 intervenciones) el 28/07/2004 20:51:29
Tengo una tabla con extensión dbf y en el sqlexplorer me indica
que es paradox el driver. De hecho puedo abrir la tabla desde un explorador que tiene delphi.

Yo no se nada ni de paradox ni de delphi, pero necesito pasar esa tabla
a tabla libre de FoxPro o Access o MySQL, lo que sea, no importa (de preferencia FoxPro).

Mi pregunta es...

Todas las tablas de paradox son DB ??? o también pueden ser DBF ???

Si es así (cualquiera de las dos). Cómo puedo exportarla a FoxPro y qué necesito???

De antemano muchas gracias....
Valora esta pregunta
Me gusta: Está pregunta es útil y esta claraNo me gusta: Está pregunta no esta clara o no es útil
0
Responder

RE:Urgente exportar

Publicado por Luis Eduardo Camacho Legro (11 intervenciones) el 03/08/2004 01:47:30
Hola El_maik

Si todas las tablas de Paradox son .db.

Las DBF creo que son de Foxpro (versión 2.6) y tambien de una DBase.

Mandame por correo los archivos para ver si te puedo ayudar.

Bye

Luis Eduardo Camacho
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
0
Comentar

Lo puedes bajar de aqui .....

Publicado por El_maik (3 intervenciones) el 03/08/2004 18:47:45
Es una tabla DBF, pero no la puedo abrir con Fox, la he podido vincular a access pero no me deja exportarla; el caso es que la necesito en FoxPro

http://www.geocities.com/mike_legn/mineria.zip

De antemano gracias
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
0
Comentar

RE:Urgente exportar

Publicado por Mike (3 intervenciones) el 28/09/2004 05:32:00
sI TENÉS UNA TABLA .DB QUE ES PARADOX DEBES IR A ARCHOVO EXPORTAR Y CUSNDO TE APARECE LA PANTALLA LA TRANSFORMAS EN DBF QUE EL aCCES LO TOMA Y POSTERIORMENTE LA PASAS COMO ACCES A FOX PRO
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
0
Comentar

RE:Urgente exportar

Publicado por indiana elver (1 intervención) el 31/10/2025 21:48:41
a revisar porfa
// // import java.sql.DatabaseMetaData; import java.sql.ResultSetMetaData; import java.sql.DriverManager; import java.sql.Connection; import java.sql.ResultSet; import java.sql.SQLException; import java.sql.Statement; import java.io.FileInputStream; import java.io.FileOutputStream; import java.io.InputStream; import java.io.OutputStream; import java.io.IOException; import java.io.InputStreamReader; import java.io.OutputStreamWriter; import java.io.PrintWriter; import java.io.File; import java.io.FileWriter; import java.io.FileReader; import java.io.BufferedReader; import java.io.BufferedWriter; import java.util.StringTokenizer; import java.util.Calendar; import java.util.Vector; import java.util.ArrayList; import java.util.Date; import java.text.SimpleDateFormat; import java.text.DateFormat; import java.lang.String; import java.net.InetAddress; import java.net.UnknownHostException; public class desa12 { boolean ServerOn = true; int State = 10; int HSCen=0; int MNCen=0; int nInterval=0; long FechaExport= 0; String ccFileExport; String ccCopiaExport; String ccDasaLog; String ccSendMail; String ccDDL; String cA2_FIC; String cA2_IMP; String cDirLog; String cA2_VERSION; String csScript; // String sFileNameLog; String ccFileHtml1 = null; String ccFileHtml2 = null; String ccFileHtml3 = null; String ccFileLista = null; // RESPECTO DE LAS LINEAS PARA ENCONTRAR DIFERENCIAS String WAAntes = null; String WADespues = null; private static InetAddress address = null; private static String sHostName = null; private static String cCadena14 = "_"; private static String cCadena19 = "_"; private static String ccSender = "sendmail -oi -t << EOF \n" + "From: [email protected] \n" + "To: $DESTINO$ \n" + "MIME-Version: 1.0 \n" + "Content-Type: text/html; charset=us-ascii \n" + "Subject: $ASUNTO$ \n" + " \n" + "<center><h3><b><FONT COLOR=\"green\"> $MENSAJE$ </FONT></h3></center> \n" + "<br> \n" + "<b> mail se ha generado en forma autom&aacute;tica \n" + "</b> <br> \n" + "<br> \n" + "<b>Atlas II<br> \n" + "EOF \n "; ArrayList<String> atablas = new ArrayList<String>(); ArrayList<String> ayHtml = new ArrayList<String>(); public static final int Is_Dormant = 10 ; public static final int Is_CheckIn = 15 ; public static final int Is_Ending = 99 ; private static final String DB_DRIVER = "oracle.jdbc.driver.OracleDriver"; // private static String DB_CONNECTION = null; // private static final String DB_USER = "atlas"; private static final String DB_PASSWORD = "atlas"; ////////////////////////////////////////////////////////////////// // Metodo.....: main() // Autor......: Golen Von Miller // Describe...: main principal ////////////////////////////////////////////////////////////////// // public static void main( String[] args ) { public static void main( String[] args ) { new desa12().desa12(); } ////////////////////////////////////////////////////////////////// // Metodo.....: desa12() // Autor......: Golen Von Miller // Describe...: es el core del automata ////////////////////////////////////////////////////////////////// public void desa12() { nInterval = 15; // 00 a 08 Is_Dormant // 08 a 22 Is_CheckIn // 22 y + Is_Ending Date fechaActual = new Date(); DateFormat formatoHora = new SimpleDateFormat("HH:mm:ss"); // StartThisServer(); SetdbConnection(); cA2_IMP = GetValVarEnv("A2_IMP"); cDirLog = GetValVarEnv("cdsl"); cA2_FIC = GetValVarEnv("A2_FIC"); ccDasaLog = cA2_IMP + "/DASA96.log"; csScript = cDirLog + "/JYBVZZ.ALLQ.sql"; ccFileExport = cA2_FIC + "/export.doc"; ccCopiaExport= cDirLog + "/export.doc"; ccSendMail = cDirLog + "/sender.eml"; ccFileHtml1 = cDirLog + "/JYAI09.DIFF.html"; ccFileHtml2 = cDirLog + "/JYAI09.ALTA.html"; ccFileHtml3 = cDirLog + "/JYAI09.BAJA.html"; ccFileLista = cDirLog + "/JYAI09.Lista.txt"; // sFileNameLog = cDirLog + "desa12.sys.Log"; FechaExport= 0; OnStateMe(); ///////////////////////////////////////// // O P E N L O G F O R D E S A 1 2 ///////////////////////////////////////// Ism_OpenFileLog(); Ism_SendToLog("Hs:[" + HSCen + ":" + MNCen + "]. Ingresa con el estado: " + State); try { Thread.sleep(5); execbatch(); } catch (Exception ee) { ee.printStackTrace(); Ism_SendToLog("NO SE PUEDE HACER UN DELAY DE 5 SEGUNDOS"); } while( ServerOn ) { switch(State) { case Is_Dormant: Ism_SendToLog("Hs:[" + HSCen + ":" + MNCen + "]. Start Dormant State: " + State); GoDormant(); break; case Is_CheckIn: Ism_SendToLog("Hs:[" + HSCen + ":" + MNCen + "]. Start CheckIn State: " + State); IsWorking(); break; case Is_Ending: Ism_SendToLog("Finalizando y Saliendo del Automata..."); ServerOn=false; break; default: ServerOn=false; break; } Ism_SendToLog("Hay cambio de estado: " + State ); OnStateMe(); } // Aqui listar la hora de finalizacion fechaActual = new Date(); Ism_SendToLog("Son las: "+formatoHora.format(fechaActual)); Ism_SendToLog("Proceso finalizado... \n"); // Ism_CloseFileLog(); } ////////////////////////////////////////////////////////////////// // Metodo.....: GetValVarEnv() // Autor......: Golen Von Miller // Describe...: Usado para traer el valor de 1 variable de entorno ////////////////////////////////////////////////////////////////// public String GetValVarEnv(String argu) { String sVarEnt = argu ; String ccRetEnt= null ; ccRetEnt = System.getenv(sVarEnt) ; return ccRetEnt ; } ////////////////////////////////////////////////////////////////// // Metodo.....: GoDormant() // Autor......: Golen Von Miller // Describe...: Bucle del estado durmiente, sin proceso alguno ////////////////////////////////////////////////////////////////// public void GoDormant() { while(State==10) { UnSleep(); OnStateMe(); } } ////////////////////////////////////////////////////////////////// // Metodo.....: IsWorking() // Autor......: Golen Von Miller // Describe...: Bucle deldel estado de Trabajo ////////////////////////////////////////////////////////////////// public void IsWorking() { try { while(State==15) { if (HayNuevoExport()) { // Ism_SendToLog("desa12 <HA DETECTADO> un requerimiento"); if ( CopiaExport( ccFileExport, ccCopiaExport )) { Ism_SendToLog("Se ha realzado una copia del export"); } Ism_SendToLog("Extrayendo los nombres de las Tablas"); // PopulateHTML(); // Load Array of HTML Template WriteHTML_HEAD(); // Write Html Header [ HTML 1 DIFF ] WriteHTML_HEAD2(); // Write Html Header [ HTML 2 BAJAS ] WriteHTML_HEAD3(); // Write Html Header [ HTML 3 ALTAS ] GetTablasExport(); // Load Array of Tables WriteLista_Tablas(); // Ism_SendToLog("Ejecutando Dasa96s"); if (Exec_Dasa96("dasa96s")) { // // Ism_SendToLog("Analizando Cantidades...."); // // Exec_Contando(); Ism_SendToLog("Inicia la comparacion...."); // WriteHTML_BODY(); // Download Datum of View with // a equal key [ HTML 1 DIFF ] // WriteHTML_FOOT(); // Write Trailer of HTML [ HTML 1 DIFF ] //-------------------------------------- WriteHTML_BODY2(); // Download Datum of View with // a equal key [ HTML 2 BAJAS ] // WriteHTML_FOOT2(); // Write Trailer of HTML [ HTML 2 BAJAS ] WriteHTML_FOOT3(); // Write Trailer of HTML [ HTML 3 ALTAS ] // SendMailHtml(); // Ism_SendToLog("Se han enviado los..."); // // // Exec_Send_Results() // // } else { Ism_SendToLog("EXISTE ALGUN PROBLEMA CON EL DASA96S!!!"); CancelaDasa96Aviso(); } } UnSleep(); OnStateMe(); } } catch(Exception ie) { ie.printStackTrace(); Ism_SendToLog("NO SE PUEDE HACER UNA DEMORA POR 15 SEGUNDOS!!!!"); } } ////////////////////////////////////////////////////////////////// // Metodo.....: HayNuevoExport() // Autor......: Golen Von Miller // Describe...: Detecta si hay nuevo archivo export.doc ////////////////////////////////////////////////////////////////// public Boolean HayNuevoExport() { Boolean bhayNuevo=false; File fipoi = null; long lLastModi = 0; try { fipoi = new File(ccFileExport); if (fipoi.exists()) { lLastModi = fipoi.lastModified(); Ism_SendToLog("FECHA DEL ANTERIOR EXPORT.DOC " + Long.toString(FechaExport)); if (lLastModi!=FechaExport) { bhayNuevo=true; FechaExport = lLastModi; Ism_SendToLog("HAY UN NUEVO EXPORT.DOC " + Long.toString(lLastModi)); } else { Ism_SendToLog("ES EL MISMO EXPORT.DOC " + Long.toString(lLastModi)); } } } catch(Exception ie) { ie.printStackTrace(); Ism_SendToLog("NO SE PUEDE HACER UNA DEMORA POR 15 SEGUNDOS!!!!"); } return bhayNuevo; } ////////////////////////////////////////////////////////////////// // Metodo.....: GetTablasExport() { // Autor......: Golen Von Miller // Describe...: Usado para extraer la lista de las tablas ////////////////////////////////////////////////////////////////// public void GetTablasExport() { String ccNameFile = ccFileExport; String ccLinea=null; String ccTabla="9_"; String ccTemp =null; BufferedReader brAux=null; FileReader eFReader=null; try { eFReader = new FileReader(ccNameFile); brAux = new BufferedReader(eFReader); while ((ccLinea = brAux.readLine()) != null) { ccTemp = ccLinea.substring(1,7); if(!ccTemp.contains(ccTabla)) { atablas.add(ccTemp); ccTabla = ccTemp; //Ism_SendToLog(ccTabla); } } brAux.close(); } catch (Exception e) { Ism_SendToLog(e.getMessage()); } } ////////////////////////////////////////////////////////////////// // Metodo.....: WriteLista_Tablas() // Autor......: Golen Von Miller // Describe...: Genera un txt con la lista de las tablas // ////////////////////////////////////////////////////////////////// public void WriteLista_Tablas() { try { File SysLisTab = new File(ccFileLista); BufferedWriter bwx = new BufferedWriter(new FileWriter(SysLisTab)); for ( int i=0; i<atablas.size(); i++) { bwx.write( atablas.get(i) + "\n"); } bwx.close(); } catch(Exception e) { e.printStackTrace(); } } ////////////////////////////////////////////////////////////////// // Metodo.....: Exec_Dasa96() { // Autor......: Golen Von Miller // Describe...: Ejecuta el job dasa96s ////////////////////////////////////////////////////////////////// public Boolean Exec_Dasa96(String argu) { String s = null; String sCmd = argu; String cAbnormal = null; String cNormal = null; Boolean FinOK = true; try { FinOK = true; cAbnormal = "ABNORMAL END OF PROGRAM"; cNormal = "NORMAL END OF JOB DASA96"; Process p = Runtime.getRuntime().exec(sCmd); BufferedReader stdInput = new BufferedReader(new InputStreamReader(p.getInputStream())); BufferedReader stdError = new BufferedReader(new InputStreamReader(p.getErrorStream())); while ((s = stdInput.readLine()) != null) { if(s.length()>10) { if((s.contains("DASA96")) && (s.contains(cAbnormal))) { FinOK = false; } } } while ((s = stdError.readLine()) != null) { Ism_SendToLog(" Err : = " + s); } } catch (IOException e) { Ism_SendToLog("SE HA PRODUCIDO UN ERROR:(IOException)"); e.printStackTrace(); FinOK = false; System.exit(-1); } return FinOK; } ////////////////////////////////////////////////////////////////// // Metodo.....: UnSleep() // Autor......: Golen Von Miller // Describe...: Usado para hacer un delay por 15 segundos ////////////////////////////////////////////////////////////////// public void UnSleep() { try { Thread.sleep(15000); } catch(Exception ie) { ie.printStackTrace(); Ism_SendToLog("NO SE PUEDE HACER UNA DEMORA POR 15 SEGUNDOS!!!!"); } } ////////////////////////////////////////////////////////////////// // Metodo.....: LongSleep() // Autor......: Golen Von Miller // Describe...: Usado para hacer un sleep a medida n x mil ////////////////////////////////////////////////////////////////// public static void LongSleep(int can) { try { Thread.sleep(can); } catch(Exception ie) { ie.printStackTrace(); Ism_SendToLog("NO SE PUEDE HACER UNA DEMORA POR 15 SEGUNDOS!!!!"); } } ////////////////////////////////////////////////////////////////// // Metodo.....: OnStateMe() // Autor......: Golen Von Miller // Describe...: check para checkar hora y dejar un estado ////////////////////////////////////////////////////////////////// public void OnStateMe() { File fipoi = null; Calendar fecha = Calendar.getInstance(); int nHora = fecha.get(Calendar.HOUR_OF_DAY); int nMinu = fecha.get(Calendar.MINUTE); State=0; HSCen=nHora; MNCen=nMinu; if((nHora>=0) && (nHora<8)) { State=40; } else if((nHora>=8) && (nHora<22)) { State=15; } else if(nHora>=22) { State=40; ServerOn=false; } /******************************************/ /* Is_Durmant 10 de 00 a 08 */ /* Is_CheckIn 15 de 08 a 22 */ /* Is_Ending despues de la 22 hs */ /******************************************/ } ////////////////////////////////////////////////////////////////// // Metodo.....: StartThisServer() // Autor......: Golen Von Miller // Describe...: Usado para realizar una presentacion en el incio ////////////////////////////////////////////////////////////////// public void StartThisServer() { try { String SnpSistema = "desa12 - Controles"; String SnpVersion = "1.0.99(C)"; String Release = "Stable"; System.out.println(SnpSistema + " - Version: " + SnpVersion + " - Release " + Release ); System.out.println("****************************************"); System.out.println("Procesadores Disponibles (cores): " + Runtime.getRuntime().availableProcessors()); System.out.println("Memoria Disponible (bytes): " + Runtime.getRuntime().freeMemory()); long maxMemory = Runtime.getRuntime().maxMemory(); System.out.println("Memoria Maxima (bytes): " + (maxMemory == Long.MAX_VALUE ? "no limit" : maxMemory)); System.out.println("Total memoria disponible para JVM (bytes): " + Runtime.getRuntime().totalMemory()); // } catch (Exception ee){ ee.printStackTrace(); } return; } ////////////////////////////////////////////////////////////////// // Metodo.....: execbatch() // Autor......: Golen Von Miller // Describe...: Usado para crear las tablas necesarias ////////////////////////////////////////////////////////////////// private static void execbatch() throws SQLException { Connection dbConnection = null; Statement sSent = null; String cnomtab = null; try { dbConnection = ConnectAtlas(); if (!TabOraExist(dbConnection, "TDZ01C")) { Ism_SendToLog("Las tablas NO estan creadas"); Ism_SendToLog("Creando las tablas..."); sSent = dbConnection.createStatement(); // sSent.addBatch("CREATE TABLE TDZ01C ( " + // "NUTAB CHAR(6) Not Null, " + // "QCLETV CHAR(20) Not Null, " + // "QXZMIL VARCHAR2(999) Not Null, " + // "PRIMARY KEY( NUTAB, QCLETV ) ) "); // // sSent.addBatch("GRANT ALL PRIVILEGES ON ATLAS.TDZ01C TO PUBLIC "); // // sSent.addBatch("CREATE PUBLIC SYNONYM TDZ01C FOR atlas.TDZ01C "); // // sSent.addBatch("CREATE TABLE TDZ14C ( " + // "NUTAB CHAR(6) Not Null, " + // "QXZ40 CHAR(40) Not Null, " + // "QXZMIL VARCHAR2(999) Not Null, " + // "PRIMARY KEY( NUTAB, QXZ40 ) ) "); // // sSent.addBatch("GRANT ALL PRIVILEGES ON ATLAS.TDZ14C TO PUBLIC "); // // sSent.addBatch("CREATE PUBLIC SYNONYM TDZ14C FOR atlas.TDZ14C "); // // sSent.addBatch("CREATE TABLE TDZ19C ( " + // "NUTAB CHAR(6) Not Null, " + // "QXZ89 CHAR(89) Not Null, " + // "QXZMIL CHAR(999) Not Null, " + // "PRIMARY KEY(NUTAB, QXZ89 ) ) "); // // sSent.addBatch("GRANT ALL PRIVILEGES ON ATLAS.TDZ19C TO PUBLIC "); // // sSent.addBatch("CREATE PUBLIC SYNONYM TDZ19C FOR atlas.TDZ19C "); // // sSent.addBatch("COMMIT "); // Ism_SendToLog("Cargando las tablas......"); // sSent.addBatch("INSERT INTO TDZ01C SELECT NUTAB, QCLETV, QXZMIL FROM TDZ01 "); // // sSent.addBatch("COMMIT "); // // sSent.addBatch("INSERT INTO TDZ14C SELECT NUTAB, QXZ40, QXZMIL FROM TDZ14 "); // // sSent.addBatch("INSERT INTO TDZ19C SELECT NUTAB, QXZ89, QXZMIL FROM TDZ19 "); // // sSent.addBatch("COMMIT "); // sSent.executeBatch(); } else { sSent = null; Ism_SendToLog("Las tablas ya estan creadas"); CargarSiEstanVacias(); } sSent = dbConnection.createStatement(); ResultSet rs = sSent.executeQuery("select distinct NUTAB from tdz14"); while (rs.next()) { cnomtab = rs.getString("NUTAB"); cCadena14 += " " + cnomtab; } rs = sSent.executeQuery("select distinct NUTAB from tdz19"); while (rs.next()) { cnomtab = rs.getString("NUTAB"); cCadena19 += " " + cnomtab; } // } catch (SQLException e) { Ism_SendToLog(e.getMessage()); } finally { if (sSent != null) { sSent.close(); } if (dbConnection != null) { dbConnection.close(); } } } ////////////////////////////////////////////////////////////////// // Metodo.....: CargarSiEstanVacias // Autor......: Golen Von Miller // Describe...: Usado para control compara cantidades de registros ////////////////////////////////////////////////////////////////// private static void CargarSiEstanVacias() throws SQLException { Connection dbConecta = null; Statement sSent = null; Statement sSen89= null; String csSQLSent= null; String ccSelect= null; int count=0; int ifx =0; try { dbConecta = ConnectAtlas(); sSent = dbConecta.createStatement(); sSen89 = dbConecta.createStatement(); //********************************************* // //***** RESTANDO CANTIDADES DE LAS TABLAS ***** // //********************************************* csSQLSent = "Select count(*) From tdz01c"; ResultSet rs = sSent.executeQuery(csSQLSent); rs.next(); count=rs.getInt(1); if (count == 0) { Ism_SendToLog("Cargando las tabla tdz01c......"); sSen89.addBatch("INSERT INTO TDZ01C SELECT NUTAB, QCLETV, QXZMIL FROM TDZ01 "); sSen89.addBatch("COMMIT "); ifx++; } csSQLSent = "Select count(*) From tdz14c"; rs = sSent.executeQuery(csSQLSent); rs.next(); count=rs.getInt(1); if (count == 0) { Ism_SendToLog("Cargando las tabla tdz14c......"); sSen89.addBatch("INSERT INTO TDZ14C SELECT NUTAB, QXZ40, QXZMIL FROM TDZ14 "); sSen89.addBatch("COMMIT "); ifx++ ; } csSQLSent = "Select count(*) From tdz19c"; rs = sSent.executeQuery(csSQLSent); rs.next(); count=rs.getInt(1); if (count == 0) { Ism_SendToLog("Cargando las tabla tdz19c......"); sSen89.addBatch("INSERT INTO TDZ19C SELECT NUTAB, QXZ89, QXZMIL FROM TDZ19 "); sSen89.addBatch("COMMIT "); ifx++; } if (ifx>0) { sSen89.executeBatch(); } } catch (SQLException e) { Ism_SendToLog(e.getMessage()); } finally { if (sSent != null) { sSent.close(); } if (dbConecta != null) { dbConecta.close(); } } } ////////////////////////////////////////////////////////////////// // Metodo.....: LoadArraystdz() // Autor......: Golen Von Miller // Describe...: Carga el Array de la tabla TDZ14 ////////////////////////////////////////////////////////////////// private static void LoadArraystdz(Connection conn, String cctdz) throws SQLException { String csSQLenv = "select distinct NUTAB from "; String cnomtab = null; Statement sSente = null; try { if (cctdz.contains("tdz14")) { csSQLenv += " tdz14"; } else { csSQLenv += " tdz19"; } sSente = conn.createStatement(); ResultSet rs = sSente.executeQuery(csSQLenv); while (rs.next()) { cnomtab = rs.getString("NUTAB"); if (cctdz.contains("tdz14")) { cCadena14 += " " + cnomtab; } else { cCadena19 += " " + cnomtab; } } } catch (SQLException e) { Ism_SendToLog(e.getMessage()); } return; } ////////////////////////////////////////////////////////////////// // Metodo.....: Exec_Contando() // Autor......: Golen Von Miller // Describe...: Usado para control compara cantidades de registros ////////////////////////////////////////////////////////////////// private void Exec_Contando() throws SQLException { Connection dbConnection = null; Statement sSent = null; String csSQLSent= null; String cNamtab= null; int count=0; try { dbConnection = ConnectAtlas(); sSent = dbConnection.createStatement(); for ( int i=0; i<atablas.size(); i++) { cNamtab = atablas.get(i); if (EstaEnATdz14(cNamtab)) { csSQLSent = "Select (Select count(*) From tdz14 where nutab= '" + cNamtab + "') - " + "(Select count(*) From tdz14c where nutab= '" + cNamtab + "') " + "from dual "; } else if (EstaEnATdz19(cNamtab)) { csSQLSent = "Select (Select count(*) From tdz19 where nutab= '" + cNamtab + "') - " + "(Select count(*) From tdz19c where nutab= '" + cNamtab + "') " + "from dual "; } else { csSQLSent = "Select (Select count(*) From tdz01 where nutab= '" + cNamtab + "') - " + "(Select count(*) From tdz01c where nutab= '" + cNamtab + "') " + "from dual "; } ResultSet rs = sSent.executeQuery(csSQLSent); while (rs.next()) { count=rs.getInt(1); Ism_SendToLog(csSQLSent + Integer.toString(count)); } } } catch (SQLException e) { Ism_SendToLog(e.getMessage()); } finally { if (sSent != null) { sSent.close(); } if (dbConnection != null) { dbConnection.close(); } } } ////////////////////////////////////////////////////////////////// // Metodo.....: WriteHTML_BODY() // Autor......: Golen Von Miller // Describe...: Usado para control compara cantidades de registros ////////////////////////////////////////////////////////////////// private void WriteHTML_BODY() throws SQLException, IOException { Connection dbConnection = null; Statement sSent = null; String csSQLenv = null; String cNamtab = null; String TablaAntes = null; String cClave = null; String cQxzmil = null; String ccLaClave = null; String ccAntes = null; String ccDespues = null; String ccTabGestab = null; String cQxzmil2 = null; String cDescribe = null; try { dbConnection = ConnectAtlas(); sSent = dbConnection.createStatement(); // File SysHtml = new File(ccFileHtml1); BufferedWriter bw1 = new BufferedWriter(new FileWriter(SysHtml,true)); // //=========================================================== // if (EstaEnATdz14(cNamtab)) { // csSQLenv = "Select anutab, aqxz40, aqxzmil, " + // "cNutab, cqxz40, cqxzmil " + // "FROM VDZ14DF1"; // } else if (EstaEnATdz19(cNamtab)) { // csSQLenv = "select anutab, aqxz89, aqxzmil, " + // "cnutab, cqxz89, cqxzmil " + // "FROM VDZ19DF1"; // } else { // csSQLenv = "select anutab, aqcletv, aqxzmil, " + // "cnutab, cqcletv, cqxzmil " + // "FROM VDZ01DF1 order by 1, 2"; // } //=========================================================== // csSQLenv = "select anutab, aqcletv, aqxzmil, " + "cnutab, cqcletv, cqxzmil " + "FROM VDZ01DF1 order by 1, 2"; ResultSet rs = sSent.executeQuery(csSQLenv); ResultSetMetaData metadata = rs.getMetaData(); // while (rs.next()) { // cNamtab = rs.getString(1); if ( cNamtab!=TablaAntes ) { // cDescribe = GetLibelleTable(cNamtab); // TABLA......: Sobre item ==> 21 $nametabla ccTabGestab = ayHtml.get(21); ccTabGestab = ccTabGestab.replace("$nametabla", cNamtab ); ccTabGestab = ccTabGestab.replace("$describe", cDescribe ); // bw1.write( "<hr> \n"); bw1.write( ccTabGestab + "\n"); bw1.write( ayHtml.get(22) + "\n"); bw1.write( ayHtml.get(23) + "\n"); // TablaAntes = rs.getString(1); } cClave = rs.getString(2); cQxzmil = rs.getString(3); cQxzmil2 = rs.getString(6); // Ism_SendToLog("cQxzmil : " + cQxzmil ); // Ism_SendToLog("cQxzmil2 : " + cQxzmil2); WAAntes = cQxzmil ; WADespues = cQxzmil2; StringCompIsma(cQxzmil, cQxzmil2); // Ism_SendToLog("WAAntes : " + WAAntes ); // Ism_SendToLog("WADespues : " + WADespues ); // CLAVE......: Sobre item ==> 24 $laclave // ANTES......: Sobre item ==> 26 $lineantes // DESPUES....: Sobre item ==> 28 $lineadesp ccLaClave = ayHtml.get(24); ccAntes = ayHtml.get(26); ccDespues = ayHtml.get(28); ccLaClave = ccLaClave.replace("$laclave", cClave ); // ccAntes = ccAntes.replace("$lineantes", cQxzmil ); // ccDespues = ccDespues.replace("$lineadesp", cQxzmil2); ccAntes = ccAntes.replace("$lineantes", WAAntes ); ccDespues = ccDespues.replace("$lineadesp", WADespues); bw1.write( ccLaClave+ "\n" ); // 24 bw1.write( ayHtml.get(25) + "\n"); bw1.write( ccAntes + "\n"); // 26 bw1.write( ccDespues + "\n"); // 28 } // // // // bw1.close(); } catch (SQLException e) { Ism_SendToLog("Error: " + e.getMessage()); } catch (IOException e) { e.printStackTrace(); } finally { if (sSent != null) { sSent.close(); } if (dbConnection != null) { dbConnection.close(); } } } ////////////////////////////////////////////////////////////////// // Metodo.....: StringCompIsma(String pAntes, String pDespues) // Autor......: Golen Von Miller // Describe...: Usado para control compara cantidades de registros ////////////////////////////////////////////////////////////////// public void StringCompIsma(String pAntes, String pDespues) { String OPAntes = null; String OPDespues = null; // try { OPAntes = ""; OPDespues = ""; if ( pAntes.length()==pDespues.length() ) { for ( int index=0; index<pAntes.length(); index++ ) { char chan = pAntes.charAt(index); char chde = pDespues.charAt(index); if ( chan==chde) { OPAntes = OPAntes + chan; OPDespues = OPDespues + chde; } else { OPAntes = OPAntes + "<code>" + chan + "</code>"; OPDespues = OPDespues + "<code>" + chde + "</code>"; } } WAAntes = OPAntes ; WADespues = OPDespues ; return; } if ( pAntes.length() > pDespues.length() ) { for ( int index=0; index<pDespues.length(); index++ ) { char chan = pAntes.charAt(index); char chde = pDespues.charAt(index); if ( chan==chde) { OPAntes = OPAntes + chan; OPDespues = OPDespues + chde; } else { OPAntes = OPAntes + "<code>" + chan + "</code>"; OPDespues = OPDespues + "<code>" + chde + "</code>"; } } WAAntes = OPAntes ; WADespues = OPDespues ; return; } if ( pAntes.length() < pDespues.length() ) { for ( int index=0; index<pAntes.length(); index++ ) { char chan = pAntes.charAt(index); char chde = pDespues.charAt(index); if ( chan==chde) { OPAntes = OPAntes + chan; OPDespues = OPDespues + chde; } else { OPAntes = OPAntes + "<code>" + chan + "</code>"; OPDespues = OPDespues + "<code>" + chde + "</code>"; } } WAAntes = OPAntes ; WADespues = OPDespues ; return; } } catch(StringIndexOutOfBoundsException e) { e.printStackTrace(); } catch(Exception eu) { eu.printStackTrace(); } } ////////////////////////////////////////////////////////////////// // Metodo.....: StringComparator() // Autor......: Golen Von Miller // Describe...: Usado para control compara cantidades de registros ////////////////////////////////////////////////////////////////// public void StringComparator() { String strAntes = WAAntes ; String strDespu = WADespues; String OPAntes = null; String OPDespues = null; // try { OPAntes = ""; OPDespues = ""; for ( int i=0; i < strAntes.length(); i++) { if ( strAntes.substring(i,1)==strDespu.substring(i, 1) ) { OPAntes = OPAntes + strAntes.substring(i, 1); OPDespues = OPDespues + strDespu.substring(i, 1); } else { OPAntes = OPAntes + "<code>" + strAntes.substring(i, 1) + "</code>"; OPDespues = OPDespues + "<code>" + strDespu.substring(i, 1) + "</code>"; } } WAAntes = OPAntes ; WADespues = OPDespues ; } catch(StringIndexOutOfBoundsException e) { e.printStackTrace(); } } ////////////////////////////////////////////////////////////////// // Metodo.....: WriteHTML_BODY2() // Autor......: Golen Von Miller // Describe...: Usado para control compara cantidades de registros ////////////////////////////////////////////////////////////////// private void WriteHTML_BODY2() throws SQLException, IOException { Connection dbConnection = null; Statement sSent = null; String csSQLenv = null; String cNamtab = null; String ccTablant = null; String cClave = null; String cQxzmil = null; String ccLaClave = null; String ccAntes = null; String ccDespues = null; String ccTabGestab = null; String cQxzmil2 = null; String cDescribe = null; try { dbConnection = ConnectAtlas(); sSent = dbConnection.createStatement(); // File SysHtml = new File(ccFileHtml2); BufferedWriter bw1 = new BufferedWriter(new FileWriter(SysHtml,true)); // csSQLenv = "select cnutab, cqcletv, cqxzmil " + "from VDZ01DF2 order by 1, 2"; ResultSet rs = sSent.executeQuery(csSQLenv); ResultSetMetaData metadata = rs.getMetaData(); // while (rs.next()) { // cNamtab = rs.getString(1); if ( cNamtab!=ccTablant ) { // cDescribe = GetLibelleTable(cNamtab); // TABLA......: Sobre item ==> 21 $nametabla ccTabGestab = ayHtml.get(21); ccTabGestab = ccTabGestab.replace("$nametabla", cNamtab ); ccTabGestab = ccTabGestab.replace("$describe", cDescribe ); // bw1.write( "<hr> \n"); bw1.write( ccTabGestab + "\n"); bw1.write( ayHtml.get(22) + "\n"); bw1.write( ayHtml.get(23) + "\n"); // ccTablant = cNamtab; // rs.getString(1); // } cClave = rs.getString(2); cQxzmil = rs.getString(3); // cQxzmil2 = rs.getString(6); // // CLAVE......: Sobre item ==> 24 19 $laclave // ANTES......: Sobre item ==> 26 21 $lineantes // DESPUES....: Sobre item ==> 28 23 $lineadesp ccLaClave = ayHtml.get(24); ccAntes = ayHtml.get(26); // ccDespues = ayHtml.get(23); ccLaClave = ccLaClave.replace("$laclave", cClave ); ccAntes = ccAntes.replace("$lineantes", cQxzmil ); // Ism_SendToLog( "ccAntes ==> " + ccAntes); // ccDespues = ccDespues.replace("$lineadesp", cQxzmil2); bw1.write( ccLaClave+ "\n" ); // 19 bw1.write( ayHtml.get(25) + "\n"); bw1.write( ccAntes + "\n"); // 21 // bw1.write( ccDespues + "\n"); // 23 } bw1.close(); } catch (SQLException e) { Ism_SendToLog("Error: " + e.getMessage()); } catch (IOException e) { e.printStackTrace(); } finally { if (sSent != null) { sSent.close(); } if (dbConnection != null) { dbConnection.close(); } } } ////////////////////////////////////////////////////////////////// // Metodo.....: EstaEnATdz14() // Autor......: Golen Von Miller // Describe...: Busca si una tabla esta en el Array de la TDZ14 ////////////////////////////////////////////////////////////////// private Boolean EstaEnATdz14(String sNomtab) { Boolean iFound = false; if (cCadena14.contains(sNomtab)) { iFound = true; } return iFound; } ////////////////////////////////////////////////////////////////// // Metodo.....: EstaEnATdz19() // Autor......: Golen Von Miller // Describe...: Busca si una tabla esta en el Array de la TDZ19 ////////////////////////////////////////////////////////////////// private Boolean EstaEnATdz19(String sNomtab) { Boolean iFound = false; if (cCadena19.contains(sNomtab)) { iFound = true; } return iFound; } ////////////////////////////////////////////////////////////////// // Metodo.....: Exec_SelectCount() // Autor......: Golen Von Miller // Describe...: Usado para control compara cantidades de registros ////////////////////////////////////////////////////////////////// private static void Exec_SelectCount() throws SQLException { Connection dbConnection = null; Statement sSent = null; String csSQLSent= null; String ccSelect= null; int count=0; try { dbConnection = ConnectAtlas(); sSent = dbConnection.createStatement(); //********************************************* //***** RESTANDO CANTIDADES DE LAS TABLAS ***** //********************************************* csSQLSent = "Select (Select count(*) From tdz01 A) - (Select count(*) From tdz01C C) from dual " + "Union all " + "Select (Select count(*) From tdz14 A) - (Select count(*) From tdz14C C) from dual " + "Union all " + "Select (Select count(*) From tdz19 A) - (Select count(*) From tdz19C C) from dual"; int i=0; ResultSet rs = sSent.executeQuery(csSQLSent); while (rs.next()) { count=rs.getInt(1); if (i == 0) { ccSelect="(Cant.Registros Tdz01) - (Cant.Registros Tdz01C)= "; } else if(i == 1) { ccSelect="(Cant.Registros Tdz11) - (Cant.Registros Tdz14C)= "; } else { ccSelect="(Cant.Registros Tdz19) - (Cant.Registros Tdz19)= "; } Ism_SendToLog(ccSelect + Integer.toString(count)); i++; } } catch (SQLException e) { Ism_SendToLog(e.getMessage()); } finally { if (sSent != null) { sSent.close(); } if (dbConnection != null) { dbConnection.close(); } } } ////////////////////////////////////////////////////////////////// // Metodo.....: TabOraExist() // Autor......: Golen Von Miller // Describe...: Usado para detectar si la tabla existe o no ////////////////////////////////////////////////////////////////// private static boolean TabOraExist(Connection conn, String tableName) throws SQLException { boolean tExists = false; try { DatabaseMetaData dbm = conn.getMetaData(); ResultSet rs = dbm.getTables(null, null, "TDZ01C", null); if (rs.next()) { tExists = true; } } catch (SQLException e) { Ism_SendToLog(e.getMessage()); } return tExists; } ////////////////////////////////////////////////////////////////// // Metodo.....: ConnectAtlas() // Autor......: Golen Von Miller // Describe...: Usado para conectar atlas atpr01 ------------ ////////////////////////////////////////////////////////////////// private static void SetdbConnection() { try { address = InetAddress.getLocalHost(); sHostName = address.getHostName(); DB_CONNECTION ="jdbc:oracle:thin:@" + sHostName + ":1521:" + System.getenv("A2_BASE"); System.out.println("DB_CONNECTION.....: " + DB_CONNECTION); } catch(Exception e) { e.printStackTrace(); } } ////////////////////////////////////////////////////////////////// // Metodo.....: ConnectAtlas() // Autor......: Golen Von Miller // Describe...: Usado para conectar atlas atpr01 ------------ ////////////////////////////////////////////////////////////////// private static Connection ConnectAtlas() { Connection dbConnection = null; try { Class.forName(DB_DRIVER); } catch (ClassNotFoundException e) { Ism_SendToLog(e.getMessage()); } try { dbConnection = DriverManager.getConnection(DB_CONNECTION, DB_USER, DB_PASSWORD); return dbConnection; } catch (SQLException e) { Ism_SendToLog(e.getMessage()); } return dbConnection; } ////////////////////////////////////////////////////////////////// // Metodo.....: SelectTdz01() // Autor......: Golen Von Miller // Describe...: Usado para hacer un select a la tadz01 ////////////////////////////////////////////////////////////////// private static void SelectTdz01() throws SQLException { Connection dbConnection = null; Statement statement = null; String selectTableSQL = "SELECT NUTAB, QCLETV, QXZMIL from TDZ01 WHERE NUTAB = 'Y903ST' ORDER BY NUTAB, QCLETV"; try { dbConnection = ConnectAtlas(); statement = dbConnection.createStatement(); Ism_SendToLog(selectTableSQL); // execute Update SQL stetement ResultSet rs = statement.executeQuery(selectTableSQL); while (rs.next()) { String ccNutab = rs.getString("NUTAB"); String ccQcletv = rs.getString("QCLETV"); String ccQxzmil = rs.getString("QXZMIL"); Ism_SendToLog(ccNutab + "|" + ccQcletv + "|" + ccQxzmil); } } catch (SQLException e) { Ism_SendToLog(e.getMessage()); } finally { if (statement != null) { statement.close(); } if (dbConnection != null) { dbConnection.close(); } } } ////////////////////////////////////////////////////////////////// // Metodo.....: PopulateHTML() // Autor......: Golen Von Miller // Describe...: Usado para tomar el template HTML // // // TITULO.....: Sobre item ==> 2 FIJO // SUBTITULO..: Sobre item ==> 6 $titulito 11 // TABLA TDZXX: Sobre item ==> 11 $tdz01 16 // TABLA......: Sobre item ==> 21 $nametabla 21 // TABLA......: Sobre item ==> 21 $describe 21 // CLAVE......: Sobre item ==> 19 $laclave 24 // ANTES......: Sobre item ==> 21 $lineantes 26 // DESPUES....: Sobre item ==> 23 $lineadesp 28 // // ////////////////////////////////////////////////////////////////// public void PopulateHTML() { ayHtml.add(" <HTML> "); ayHtml.add(" <HEAD> "); ayHtml.add(" <TITLE> Controles Gestab -post dasa96 </TITLE> "); ayHtml.add(" </HEAD> "); ayHtml.add(" </BODY> "); ayHtml.add(" <STYLE type=\"text/css\"> "); ayHtml.add(" code { font-weight:bold; "); ayHtml.add(" font-size:14px; "); ayHtml.add(" color: red; background-color: #1237c7;} "); ayHtml.add(" </STYLE> "); ayHtml.add(" <center> "); ayHtml.add(" <h3> <h1 align=\"center\"> $titulito$ "); ayHtml.add(" </h1> "); ayHtml.add(" </h3> "); ayHtml.add(" </center> "); ayHtml.add(" <hr> "); ayHtml.add(" <h2> Origen de los Datos: $tdz01$ </h2> "); ayHtml.add(" <p> "); ayHtml.add(" <font size=\"2\" face=\"Consolas, Courier New, MS Sans Serif\"> "); ayHtml.add(" <br/> "); ayHtml.add(" <b> "); ayHtml.add(" <font color=\"red\">TABLA : $nametabla : $describe </font> "); ayHtml.add(" <br> "); ayHtml.add(" <b> "); ayHtml.add(" <font color=\"red\">CLAVE : $laclave </font> "); ayHtml.add(" <br/> "); ayHtml.add(" $lineantes <br>"); ayHtml.add(" <br/> "); ayHtml.add(" $lineadesp <br>"); ayHtml.add(" <br/> "); ayHtml.add(" <p> "); ayHtml.add(" <hr> <center> <h3> "); ayHtml.add(" <h1 align=\"center\"> Reporte Generado desde: $namehost$ "); ayHtml.add(" </h1> "); ayHtml.add(" </h3> "); ayHtml.add(" </center> "); ayHtml.add(" <hr> "); ayHtml.add(" </BODY> "); ayHtml.add(" </HTML> "); ayHtml.add(" "); } ////////////////////////////////////////////////////////////////// // Metodo.....: WriteHTML_HEAD() // Autor......: Golen Von Miller // Describe...: Usado para grabar la PRIMERA parte del HTML // ////////////////////////////////////////////////////////////////// public void WriteHTML_HEAD() { try { String cViewGestab = null; File SysHtml = new File(ccFileHtml1); BufferedWriter bw9 = new BufferedWriter(new FileWriter(SysHtml)); // for (int i = 0; i < 16; i++) { for (int i = 0; i < 21; i++) { cViewGestab = ayHtml.get(i); if ( cViewGestab.contains("$tdz01$")) { cViewGestab = cViewGestab.replace("$tdz01$", "VDZ01DF1" ); } if ( cViewGestab.contains("$titulito$")) { cViewGestab = cViewGestab.replace("$titulito$", "GESTAB - DIFERENCIAS" ); } // bw9.write( ayHtml.get(i) + "\n"); bw9.write( cViewGestab + "\n"); } bw9.close(); } catch(Exception e) { e.printStackTrace(); } } ////////////////////////////////////////////////////////////////// // Metodo.....: WriteHTML_HEAD2() // Autor......: Golen Von Miller // Describe...: Usado para grabar las Atlas parte del HTML // ////////////////////////////////////////////////////////////////// public void WriteHTML_HEAD2() { try { String cViewGestab = null; File SysHtml = new File(ccFileHtml2); BufferedWriter bw4 = new BufferedWriter(new FileWriter(SysHtml)); // for (int i = 0; i < 16; i++) { for (int i = 0; i < 21; i++) { cViewGestab = ayHtml.get(i); if ( cViewGestab.contains("$tdz01$")) { cViewGestab = cViewGestab.replace("$tdz01$", "VDZ01DF2" ); } if ( cViewGestab.contains("$titulito$")) { cViewGestab = cViewGestab.replace("$titulito$", "GESTAB - BAJAS" ); } bw4.write( cViewGestab + "\n"); } bw4.close(); } catch(Exception e) { e.printStackTrace(); } } ////////////////////////////////////////////////////////////////// // Metodo.....: WriteHTML_HEAD3() // Autor......: Golen Von Miller // Describe...: Usado para grabar las Atlas parte del HTML // ////////////////////////////////////////////////////////////////// public void WriteHTML_HEAD3() { try { String cViewGestab = null; File SysHtml = new File(ccFileHtml3); BufferedWriter bw4 = new BufferedWriter(new FileWriter(SysHtml)); // for (int i = 0; i < 16; i++) { for (int i = 0; i < 21; i++) { cViewGestab = ayHtml.get(i); if ( cViewGestab.contains("$tdz01$")) { cViewGestab = cViewGestab.replace("$tdz01$", "VDZ01DF3" ); } if ( cViewGestab.contains("$titulito$")) { cViewGestab = cViewGestab.replace("$titulito$", "GESTAB - ALTAS" ); } bw4.write( cViewGestab + "\n"); } bw4.close(); } catch(Exception e) { e.printStackTrace(); } } ////////////////////////////////////////////////////////////////// // Metodo.....: WriteHTML_FOOT() // Autor......: Golen Von Miller // Describe...: Usado para grabar la ultima parte de las DIF de // la TDZ01 ////////////////////////////////////////////////////////////////// public void WriteHTML_FOOT() { try { String ccLinea =null; File SysHtml = new File(ccFileHtml1); BufferedWriter bw6 = new BufferedWriter(new FileWriter(SysHtml,true)); // for (int i = 24; i < 35; i++) { for (int i = 29; i < 40; i++) { ccLinea = ayHtml.get(i); if ( ccLinea.contains("$namehost$")) { ccLinea = ccLinea.replace("$namehost$", sHostName ); } bw6.write( ccLinea + "\n"); } bw6.close(); } catch(Exception e) { e.printStackTrace(); } } ////////////////////////////////////////////////////////////////// // Metodo.....: WriteHTML_FOOT2() // Autor......: Golen Von Miller // Describe...: Usado para grabar la ultima parte de las ALTAS TDZ01 // ////////////////////////////////////////////////////////////////// public void WriteHTML_FOOT2() { try { String ccLinea =null; File SysHtml = new File(ccFileHtml2); BufferedWriter bw5 = new BufferedWriter(new FileWriter(SysHtml,true)); // for (int i = 24; i < 35; i++) { for (int i = 29; i < 40; i++) { ccLinea = ayHtml.get(i); if ( ccLinea.contains("$namehost$")) { ccLinea = ccLinea.replace("$namehost$", sHostName ); } bw5.write( ccLinea + "\n"); } bw5.close(); } catch(Exception e) { e.printStackTrace(); } } ////////////////////////////////////////////////////////////////// // Metodo.....: WriteHTML_FOOT3() // Autor......: Golen Von Miller // Describe...: Usado para grabar la ultima parte de las ALTAS TDZ01 // ////////////////////////////////////////////////////////////////// public void WriteHTML_FOOT3() { try { String ccLinea =null; File SysHtml = new File(ccFileHtml3); BufferedWriter bws1 = new BufferedWriter(new FileWriter(SysHtml,true)); // for (int i = 24; i < 35; i++) { for (int i = 29; i < 40; i++) { ccLinea = ayHtml.get(i); if ( ccLinea.contains("$namehost$")) { ccLinea = ccLinea.replace("$namehost$", sHostName ); } bws1.write( ccLinea + "\n"); } bws1.close(); } catch(Exception e) { e.printStackTrace(); } } ////////////////////////////////////////////////////////////////// // Metodo.....: CopiaExport() // Autor......: Golen Von Miller // Describe...: Usado para copra archivos desde hasta // ////////////////////////////////////////////////////////////////// public boolean CopiaExport(String paramFD, String paramFH) {
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
0
Comentar

Urgente exportar

Publicado por COLEN PHILLINS (1 intervención) el 31/10/2025 21:57:15
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
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
/*----------------------------------------------------------------*\
 * Nombre         : oServer.c                                    *
 * ---------------------------------------------------------------*
 *----------------------------------------------------------------*
 * Compile        : cc -o oServer.o -c oServer.c
 * Compile        : cc -o oServer.o -c oServer.c -w
 * Enlace Binario : cc -o oServer oServer.o -w
 *----------------------------------------------------------------*
 *               curl -v telnet://11.212.30.70:1921
 *               curl -v telnet://Host56narvi.red.intra:1921
\*----------------------------------------------------------------*/
 
#define Equ     ==
#define And     &&
#define Or      ||
 
#define SOCKET  int
 
#include <netinet/in.h>
#include <netinet/tcp.h>
#include <arpa/inet.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <sys/wait.h>
#include <time.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <errno.h>
#include <unistd.h>
 
/*--------------------------------------------------------------*\
 | Max of IO errors when no value is defined                    |
\*--------------------------------------------------------------*/
#define OVERSION      "1.8.9(Release)"
 
#define FAILURE       (-1)
#define MAX_IO_ERRORS (9999)
#define false         (0)
#define true          (!false)
 
#define TRUE  1
#define FALSE 0
 
/*--------------------------------------------------------------*\
 | Max of Length of char * variables                            |
\*--------------------------------------------------------------*/
#define LMAX_FILE     220     /*   Usado para variables PATH+NAMFELE.EXT           */
#define LMAX_CMND     280     /*   Usado para comandos and ShellScripts            */
#define LMAX_MSGE     280     /*   Usado para definir longitud de Mensaje          */
#define LMAX_TITU     90      /*   Usado para definir vars de ASUNTO  de mail      */
#define LSUB_MAIL     280     /*                                                   */
#define LDES_MAIL     220     /*                                                   */
#define LMAX_RESP     220     /*                                                   */
 
#define TENGO_Q_SALIR 0
 
/*--------------------------------------------------------------*\
 | Definition of tipo Procedencia                               |
\*--------------------------------------------------------------*/
#define IS_DATANET    1
#define IS_CERRAR     5
 
/*--------------------------------------------------------------*\
 | Functions Prototype                                          |
\*--------------------------------------------------------------*/
int Recibe(SOCKET Socket, char * cCadena, int nBuffLen) ;
int Presentacion() ;
int GetProcedencia( char * cMensaje ) ;
int GetProcedenciav2( char * cMensaje );
 
void GetNameDatanetLog(char * ccDataLog);
void GetNameDatanetResp(char * ccDataResp);
void GetNameJyam11Log(char * ccJyam11Log);
void GetRespuestaDatanet(char * ccRipo, char * cNameFile);
void GrabaLogs(char * ccFileLog, char * cMessage, char * cRpta);
void GrabaDatanetLog(char * cMessage, char * cRpta);
void GrabaLogJyam11(char * cMessage );
void SendMailDataNet(char * cSubject, char * cGrupete) ;
void SaveBodyDataNet(char * cStrLine, char * ccAsunto);
void GetAsuntoMail(char * ccSubject, char * ccResp );
int GetCodigoRespuesta(char * cRespuesta);
void EliminaLogs(char * cArchivo) ;
 
 
void Rta_RTrim( char * ccDestino, char a[LMAX_FILE]);
void rtrim( char * ccDestino, char a[LMAX_MSGE]);
void ltrim( char * ccDestino, char b[LMAX_MSGE]);
void  trim( char * ccDestino, char c[LMAX_MSGE]);
 
void AvisoToCompliance( char * cStrLine );
void ProcJyam11();
int GetPortOfListen();
void GrabaTCPULog(char * cMessage);
void QuitarEndOfLine( char *cadenaOriginal );
void QuitarExtChar( char *cadenaOriginal );
void getSubString(char *str, char *subStr, int start, int length);
 
static char Error110[] = "Saldo Insuficiente";
static char Error104[] = "Cuenta Invalida o Inexistente";
static char Error105[] = "Cuenta Cerrada";
static char Error106[] = "Operacion Fuera de Fecha";
static char Error107[] = "Error Interno en Particularidades De La Cuenta";
static char Error108[] = "Cuenta Bloqueada";
static char Error113[] = "Importe en Cero ";
static char Error114[] = "Param.Divisa del Movim. Faltante ";
static char Error999[] = "Error Interno. No Se Ejecuta Bloqueo de Saldo en PALLAS II";
static char ErrorDef[] = "Error Indefinido";
/*-------------------------------------------------------------*\
 | Nombre......: main()                                        |
 | Tipo........: void                                          |
 | Autor.......: Golen Von Miller                                 |
 | Fecha.......: 15-05-2009                                    |
 | ............:                                               |
 | Descripcion.:                                               |
 | ............:                                               |
\*-------------------------------------------------------------*/
int main(int argc, char *argv[]) {
 
     SOCKET  ServerSocket = 0;
     SOCKET  ClientSocket = 0;
     struct  sockaddr_in    ServerInetAddress = { 0,0,0,0};
     struct  linger linger = { 0 , 0 };
     long    InetAddressLen = sizeof(ServerInetAddress);
     int     port      = 0,
             nLen      = 0;
 
     int     bNoDelay  = 1;
     int     nSysProcd = 0;
 
     char    ccTcplog[LMAX_MSGE]    = {0x00};
 
     char    ccRegLog[LMAX_MSGE]    = {0x00};
     char    scCadena[LMAX_MSGE]    = {0x00};
     char    cCadena [LMAX_MSGE]    = {0x00};
     char    *pCadena               = cCadena;
 
     char    cc_Jcl_GLVER34[LMAX_MSGE] = {0x00};
     char    cDatanetLog[LMAX_FILE] = {0x00} ;
     char    cDatanetRta[LMAX_FILE] = {0x00} ;
 
     char    ccResp[LMAX_FILE]      = {0x00};
     char    cAsunto[LMAX_TITU]     = {0x00} ;
 
     int     iConDatanet            = 0;
     int     iCblo                  = 0;
     int     idErroneos             = 0;
     int     ioErroneos             = 0;
     int     EstoyActivo            = 1;
     char    ccCblo[6]              = {0x00} ;
 
     pthread_attr_t tattr;
     pthread_t   handJyam11;
     void *status;
     /*======================================*/
     char client_ip[INET_ADDRSTRLEN];
     /*======================================*/
     time_t RawTime;
     char ccRawTime[25]      = {0x00} ;
 
     char cDreamTeam[LDES_MAIL]   = "polan.truv@au.korean.com,golen.fgf@au.korean.com";
     char cCapitMarket[LDES_MAIL] = "Sea.bo.capmarket@ua.korean.com,ism.vera@au.korean.com";
 
     Presentacion() ;
     /*--------------------------------------------------*\
      *  Allocate the server's socket descriptor         *
     \*--------------------------------------------------*/
     if  ((ServerSocket = socket(AF_INET,SOCK_STREAM, 0)) == FAILURE) {
          printf("Error de creacion del socket\r\n");
          system( "GLVER34 MAIL" );
          exit(FAILURE);
     }
     printf("Socket creado\r\n");
     /*--------------------------------------------------*\
      *  Set the linger option to force immediate closing*
     \*--------------------------------------------------*/
     linger.l_onoff  = 1; /* turn on timer     */
     linger.l_linger = 0; /* close immediately */
     if  ((setsockopt(ServerSocket, SOL_SOCKET, SO_LINGER, (char *)(&linger), sizeof(linger))) == FAILURE)
     {
           printf("Error de opcion sobre el socket - linger\r\n");
           system( "GLVER34 MAIL" );
           exit(FAILURE);
     }
     /*--------------------------------------------------*\
      *  Don't buffer up requests - send them immediately*
     \*--------------------------------------------------*/
     if  ((setsockopt(ServerSocket, IPPROTO_TCP, TCP_NODELAY, (char *)(&bNoDelay), sizeof(bNoDelay))) == FAILURE) {
          printf("Error de creacion del socket - delay\r\n");
          system( "GLVER34 MAIL" );
          exit(FAILURE);
     }
 
     GetNameDatanetLog(cDatanetLog);
     printf("LOG Datanet \t %s \n", cDatanetLog) ;
 
     printf("***************************************************************************\r\n");
     printf("Transferencias Datanet Online ONLINE \t\t Version %s \n", OVERSION);
     printf("***************************************************************************\r\n");
     GetNameDatanetResp(cDatanetRta);
     /*--------------------------------------------------*\
     *  Initialize the socket address so we can bind it   *
     \*--------------------------------------------------*/
     /*
      |
      |  port = atoi(argv[1]);
      |  ---------------------
      */
     port=GetPortOfListen();
     printf("Port Number[ %i ]\n", port);
 
     memset(&ServerInetAddress, 0x00, sizeof(ServerInetAddress));
     ServerInetAddress.sin_family      = AF_INET;
     ServerInetAddress.sin_addr.s_addr = INADDR_ANY; /* Let anyone connect  */
     ServerInetAddress.sin_port        = htons(port);
 
     /*------------------------------------------*\
     * Bind socket to the well-known port number  *
     \*------------------------------------------*/
     if (bind(ServerSocket, (struct sockaddr*)&ServerInetAddress, sizeof(ServerInetAddress)) == FAILURE)
     {
         printf("Error de enlace al socket\r\n");
         system( "GLVER34 MAIL" );
         exit(FAILURE);
     }
     /*--------------------------------------------------*\
      * Show we are willing to listen                    *
     \*--------------------------------------------------*/
     if (listen(ServerSocket, 1) == FAILURE) {
 
         printf("Error de escucha sobre el socket\r\n");
         system( "GLVER34 MAIL" );
         exit(FAILURE);
     }
     EstoyActivo=1;
     while ( EstoyActivo ) {
         printf("Escuchando...\r\n");
         /*if ((ClientSocket = accept(ServerSocket, (struct sockaddr*)&ServerInetAddress, &InetAddressLen)) == FAILURE) */
         if ((ClientSocket = accept(ServerSocket , (struct sockaddr*)&ServerInetAddress,(socklen_t *)&InetAddressLen)) == FAILURE) {
              printf("Error de aceptacion sobre el socket\r\n");
              system( "GLVER34 MAIL" );
              exit(FAILURE);
         }
         memset(ccTcplog, '\0', sizeof(ccTcplog));
         memset(ccRawTime, '\0', sizeof(ccRawTime));
         time(&RawTime);
         sprintf(ccRawTime,"%s", ctime( &RawTime ) );
         /*===========================================================================================*/
         inet_ntop(AF_INET, &(ServerInetAddress.sin_addr), client_ip, INET_ADDRSTRLEN);
         /*   printf("Client IP: %s\n", client_ip);   */
         printf("Conexion IP [%s] aceptada:(handle: %i) Hora [%s]\n", client_ip, ClientSocket, ccRawTime);
         sprintf(ccTcplog, "IP[ %s ] Conectada a Hs:[ %s ] ", client_ip, ctime( &RawTime ) );
         // QuitarEndOfLine( ccTcplog );
         GrabaTCPULog( ccTcplog );
         /*===========================================================================================*/
         /*
          printf("Conexion cliente aceptada:(%i)\r\n",ClientSocket);
          */
         /*---------------------------------*\
          *  Recibe data from the client    *
         \*---------------------------------*/
         memset( scCadena, '\0', sizeof(scCadena));
         memset(  cCadena, '\0', sizeof( cCadena));
         if ((nLen=Recibe(ClientSocket, scCadena, sizeof(scCadena)-1)) < 0) {
              close(ClientSocket);
              ClientSocket = 0;
              printf("Conexion cliente cerrada\r\n");
              system( "GLVER34 ERROR" );
              continue ;
         } else {
             QuitarExtChar( scCadena ); /**/
             memset(ccTcplog, '\0', sizeof(ccTcplog));
             strncpy(ccTcplog, scCadena, 228);
             printf("acabo de recibir:(%s)\r\n", ccTcplog);
             memset(ccTcplog, '\0', sizeof(ccTcplog));
             strncpy(ccTcplog, scCadena, 220);
             GrabaTCPULog( ccTcplog );
 
             memset(ccRawTime, '\0', sizeof(ccRawTime));
             time(&RawTime);
 
             sprintf(ccRawTime,"%s", ctime( &RawTime ) );
 
             /* printf("Recv of Time:  %s\n", ccRawTime);  */
 
             memset(ccRegLog, '\0', sizeof(ccRegLog));
 
             rtrim( cCadena, scCadena );
             pCadena = cCadena ;
 
             /*  printf("(%s)\r\n", cCadena);             */
             memcpy(scCadena, cCadena, LMAX_MSGE );
 
             sprintf(ccRegLog, "%s  : %s\n", cCadena , ccRawTime );
             /* printf("%s \n", ccRegLog);                */
 
             memcpy(scCadena, cCadena, LMAX_MSGE );
             QuitarEndOfLine( cCadena );
             nSysProcd=GetProcedenciav2( cCadena );
             switch (nSysProcd)
             {
             case IS_DATANET:
 
                    memset(cc_Jcl_GLVER34, '\0', sizeof(cc_Jcl_GLVER34));
                    strncpy(cc_Jcl_GLVER34,"GLVER34 ",7) ;
                    /*-------------------------------------------------*\
                     *       PONE DELIMTADOR DE DOBLES COMILLAS        *
                    \*-------------------------------------------------*/
                    /*
                     |                   strcat( cc_Jcl_GLVER34, "\"") ;
                     */
                    strcat( cc_Jcl_GLVER34, "\"");
                    strcat( cc_Jcl_GLVER34, cCadena);
                    strcat( cc_Jcl_GLVER34, "\"");
                    /*
                     |                    strncat( cc_Jcl_GLVER34, "\"", 1) ;
                     */
                    /*-------------------------------------------------*\
                     *       EJECUTA EL JCL SELECCIONADO               *   1234567890
                    \*-------------------------------------------------*/
                    /*
                     | printf("[%s]\n", cc_Jcl_GLVER34);
                     */
                    system( cc_Jcl_GLVER34 ) ;
                    memset( ccResp, '\0', sizeof(ccResp));
 
                    GetRespuestaDatanet(ccResp, cDatanetRta);
 
                    iCblo=0;
                    memset( ccCblo, '\0', sizeof(ccCblo));
                    strncpy(ccCblo, &ccResp[46], 3);
                    iCblo=atoi(ccCblo) ;
                    printf("Respuesta[%s]  Numerico[%i]\n", ccResp, iCblo );
                    /*=======================================================*/
                    /* iCblo=GetCodigoRespuesta(ccResp);                     */
                    /* printf("GetCodigoRespuesta(ccResp)=[%i] \n",iCblo) ;  */
                    /*=======================================================*/
                    GrabaTCPULog( ccResp );
                    if ( iCblo Equ 120) {
                         printf("ccRegLog=[%s] \n",ccRegLog) ;
                         GrabaLogJyam11( ccRegLog );
                    }
                    /*=======================================*/
                    strcat(ccResp, "\x03");
                    /*=======================================*/
                    if (send(ClientSocket, ccResp, strlen(ccResp), 0) == FAILURE) {
                         close(ClientSocket);
                         ClientSocket = 0;
                         system( "GLVER34 ERROR" );
                    }
                    iConDatanet=iConDatanet+1;
                    GrabaDatanetLog(ccRegLog, ccResp) ;
                    /*
                      aqui se eleimino gran parte del codigo
                      que sera reemplazado por un shell
                      en otro job
                    */
                    break;
             case IS_CERRAR:
 
                    EstoyActivo = TENGO_Q_SALIR;
                    break;
 
             default:
                    printf("resultado en nSysProcd: %i \r\n", nSysProcd);
                    printf("Procedencia ERRONEA \n");
             }
         }
         /*----------------------------------------------------*\
          *        INICIALIZA VARIABLE PUNTERO AL CLIENT-SOCKET*
         \*----------------------------------------------------*/
         printf("Respuesta Enviada....\n");
         close(ClientSocket) ;
         ClientSocket = 0 ;
     }
     /*---------------------------------------------------*\
      * CLOSE THE SERVER CONNECTION - ONLY WHEN NO MORE   *
      * CONNECTION REQUESTS WILL BE ACCEPTED              *
     \*---------------------------------------------------*/
     close(ServerSocket);
     ServerSocket = 0;
     printf("fin de programa\r\n");
     return 0;
}
 
/*-------------------------------------------------------------*\
 | Nombre......: Recibe()                                      |
 | Tipo........: void                                          |
 | Autor.......: Golen Von Miller                                 |
 | Fecha.......: 15-05-2009                                    |
 | ............:                                               |
 | Descripcion.:                                               |
 | ............:                                               |
\*-------------------------------------------------------------*/
int Recibe(SOCKET Socket, char * cCadena, int nBuffLen) {
     int  nBytesRx  = 0,
          nLen      = 0,
          nBlocklen = nBuffLen;
     char *p = cCadena;
     while( true ) {
         if ((nBytesRx = recv(Socket, p, nBlocklen - nLen, 0)) == FAILURE)
             return FAILURE;
         else if ( 0 == nBytesRx )
             break;
 
         if( nBlocklen - nLen == 0)
             break;
         if( strchr(p, 0x03) )
             break;
         if( strchr(p, 0x0d) )
             break;
         if( strchr(p, 0x0a) )
             break;
         if( strchr(p, 0x0D) )
             break;
         if( strchr(p, 0x0A) )
             break;
 
         nLen += nBytesRx;
         p += nBytesRx;
     }
     nLen = nBlocklen;
     return nLen;
}
/*-------------------------------------------------------------*\
 | Nombre......: Presentacion()                                |
 | Tipo........: void                                          |
 | Autor.......: Golen Von Miller                                 |
 | Fecha.......: 15-05-2009                                    |
 | ............:                                               |
 | Descripcion.:                                               |
 | ............:                                               |
\*-------------------------------------------------------------*/
int Presentacion() {
      char cA2_Type_Env[LMAX_FILE]={0x00} ;
      char cA2_LibEnv[LMAX_FILE]={0x00} ;
      char cA2_Base[LMAX_FILE]={0x00} ;
      char cA2_OraVer[LMAX_FILE]={0x00} ;
      char cA2_NivPatch[LMAX_FILE]={0x00} ;
      char cA2_Niv_Info[LMAX_FILE]={0x00} ;
 
      printf("***************************************************************************\r\n");
      printf("GOLIAN tea \t\t\t Aires\n") ;
      printf("PALLAS II    \t\t\t DEV\n") ;
      printf("***************************************************************************\r\n");
      memcpy(cA2_Type_Env, getenv("A2_TYPE_ENV"), LMAX_FILE );
      memcpy(cA2_LibEnv  , getenv("A2_LIBENV"), LMAX_FILE );
      memcpy(cA2_Base    , getenv("A2_BASE"), LMAX_FILE );
      memcpy(cA2_OraVer  , getenv("A2_ORAVER"), LMAX_FILE );
      memcpy(cA2_NivPatch, getenv("A2_NIVPATCH"), LMAX_FILE );
      memcpy(cA2_Niv_Info, getenv("A2_NIV_INFO"), LMAX_FILE );
 
      printf("Tipo Ambiente      \t %s \n", cA2_Type_Env ) ;
      printf("Ambiente           \t %s \n", cA2_LibEnv   ) ;
      printf("Nombre de la Base  \t %s \n", cA2_Base     ) ;
      printf("Version Oracle     \t %s \n", cA2_OraVer   ) ;
      printf("Nivel de Gestab    \t %s \n", cA2_NivPatch ) ;
      printf("Nivel de DIN       \t %s \n", cA2_Niv_Info ) ;
      return 0;
}
/*-------------------------------------------------------------*\
 | Nombre......: GetProcedencia()                              |
 | Tipo........: int                                           |
 | Autor.......: Golen Von Miller                                 |
 | Fecha.......: 15-05-2009                                    |
 | ............:                                               |
 | Descripcion.: SELECCION DEL SHELL A EJECUTAR DE ACUERDO A   |
 | ............: PROCEDENCIA DEL MENSAJE QUE PUEDE SER:        |
 | ............: "DATANET"                                     |
\*-------------------------------------------------------------*/
int GetProcedencia( char * cMensaje ) {
 
      char cProcen[8] = "" ;
      int iComp1      = 0 ;
      int iComp5      = 0 ;
      char *pMensaje  = cMensaje ;
      int nResul      = -1 ;
 
      strncpy(cProcen, &pMensaje[51], 7) ;
 
      iComp1  = strncmp(cProcen,"DATANET",7) ;
      iComp5  = strncmp(cProcen,"CERRAR ",7) ;
 
      if (iComp1!=0 && iComp5!=0)
          nResul = -1 ;
      if (iComp1==0)
          nResul = 1 ;
      if (iComp5==0)
          nResul = 5 ;
      return nResul ;
}
/*-------------------------------------------------------------*\
 | Nombre......: int GetProcedenciav2( char * cMensaje )       |
 | Tipo........: int                                           |
 | Autor.......: Golen Von Miller                                 |
 | Fecha.......: 03-04-2025                                    |
 | ............:                                               |
 | Descripcion.: SELECCION DEL SHELL A EJECUTAR DE ACUERDO A   |
 | ............: PROCEDENCIA DEL MENSAJE QUE PUEDE SER:        |
 | ............: "DATANET"                                     |
\*-------------------------------------------------------------*/
int GetProcedenciav2( char * cMensaje ) {
 
      char ccCoaTrf[8] = {0x00};
      int iComp1       = 0 ;
      char csData[245] ={0x00};
      int nResul       = -1 ;
 
      memset(csData,'\0', sizeof(csData));
      memset(ccCoaTrf,'\0', sizeof(ccCoaTrf));
      strcat(csData, cMensaje);
      getSubString(csData, ccCoaTrf, 51, 7);
      /*
        printf("In getSubString [%s]\n", ccCoaTrf );
       */
 
      iComp1  = strcmp(ccCoaTrf,"DATANET") ;
      if ( iComp1==0)
           nResul = 1 ;
      else
           nResul = -1 ;
      return nResul ;
}
 
/*-------------------------------------------------------------*\
 | Nombre......: GetNameDatanetLog()                           |
 | Tipo........: void                                          |
 | Autor.......: Golen Von Miller                                 |
 | Fecha.......: 05-05-2009                                    |
 | ............:                                               |
 | Descripcion.: Genera el Nombre del Archivo LOG donde grabara|
 |               el Mensaje que llega por Socket               |
\*-------------------------------------------------------------*/
void GetNameDatanetLog(char * ccDataLog) {
 
      /* memset(ccDataLog, '\0', sizeof(ccDataLog));   */
 
      memset(ccDataLog, '\0', LMAX_FILE);
      memcpy(ccDataLog, getenv("A2_IMP"), LMAX_FILE );
      /*  printf("ccDataLog es : %s\n ", ccDataLog );   */
 
      strcat(ccDataLog, "/GLVER34.DATANET.log" );
 
      /*  printf("ccDataLog es : %s\n ", ccDataLog );  */
      return;
}
 
/*-------------------------------------------------------------*\
 | Nombre......: GetNameDatanetResp()                          |
 | Tipo........: void                                          |
 | Autor.......: Golen Von Miller                                 |
 | Fecha.......: 05-05-2009                                    |
 | ............:                                               |
 | Descripcion.: Genera el Nombre del Archivo donde Leera la   |
 |               PRESPUESTA del Programa Cobol que Ejecuta el  |
 |               Mensaje para DATANET                          |
\*-------------------------------------------------------------*/
void GetNameDatanetResp(char * ccDataResp) {
      /*  memset(ccDataResp, '\0', sizeof(ccDataResp));   */
      memset(ccDataResp, '\0', LMAX_FILE);
      memcpy(ccDataResp, getenv("A2_IMP"), LMAX_FILE );
      strcat(ccDataResp, "/GLVER34.XM001.sysout" );
      return;
}
 
/*-------------------------------------------------------------*\
 | Nombre......: GetNameJyam11Log()                            |
 | Tipo........: void                                          |
 | Autor.......: Golen Von Miller                                 |
 | Fecha.......: 08-12-2022                                    |
 | ............:                                               |
 | Descripcion.: Genera el Nombre del Archivo LOG donde grabara|
 |               el Mensaje que genero una respuest 120        |
\*-------------------------------------------------------------*/
void GetNameJyam11Log(char * ccJyam11Log) {
      memset(ccJyam11Log, '\0', LMAX_FILE);
      memcpy(ccJyam11Log, getenv("A2_IMP"), LMAX_FILE );
      strcat(ccJyam11Log, "/GLVER34.SOLO120.log" );
      return;
}
 
/*-------------------------------------------------------------*\
 | Nombre......: GetRespuestaDatanet()                         |
 | Tipo........: void                                          |
 | Autor.......: Golen Von Miller                                 |
 | Fecha.......: 05-05-2009                                    |
 | ............:                                               |
 | Descripcion.: Lee la Respuesta de DATANET                   |
\*-------------------------------------------------------------*/
void GetRespuestaDatanet(char * ccRipo, char * cNameFile) {
      /*
       | char  cResp[LMAX_RESP] = {0x00};
       | FILE *HandDatanet = NULL ;
       | HandDatanet = fopen(cNameFile, "r") ;
       | fread( cResp, 1, sizeof(cResp), HandDatanet );
       | fclose( HandDatanet ) ;
       | HandDatanet = NULL;
       |===============================================
       | memcpy(ccRipo, cResp, LMAX_RESP );
       | strncpy(ccRipo, cResp, strlen(cResp) - 1);
       |===============================================
       | memcpy(ccRipo, cResp, LMAX_RESP );
       | printf("Leido en GLVER34.XM001.sysout [%s]\n", ccRipo);
       | return;
       */
      char  cResp[LMAX_RESP] = {0x00};
      FILE *HandDatanet = NULL ;
      HandDatanet = fopen(cNameFile, "r") ;
      fread( cResp, 1, sizeof(cResp), HandDatanet );
      fclose( HandDatanet ) ;
      HandDatanet = NULL;
      memcpy(ccRipo, cResp, LMAX_RESP );
      /*
       |  printf("Leido en GLVER34.XM001.sysout [%s]\n", ccRipo);
       */
      return;
}
 
/*-------------------------------------------------------------*\
 | Nombre......: GrabaLogs()                                   |
 | Tipo........: void                                          |
 | Autor.......: Golen Von Miller                                 |
 | Fecha.......: 15-05-2009                                    |
 | ............:                                               |
 | Descripcion.: Graba Logs de DATANET                         |
 | ............: Mensaje y Respuesta                           |
 | MODIFICACION: Golen Von Miller       ( 24-08-2016 )            |
 | ............: SE EXTIENDE EL LARGO DEL REGISTRO DE LOGS A   |
 | ............: 240 CARACTERES.                               |
\*-------------------------------------------------------------*/
void GrabaLogs(char * ccFileLog, char * cMessage, char * cRpta) {
 
      time_t RawDatetime;
      char ccRawDatetime[26] = {0x00};
      char strAnsw[120] = {0x00};
      FILE *prFileLog = NULL ;
      char cRegistro[LMAX_MSGE]={0x00};
 
      memset(ccRawDatetime, '\0', 26);
      time(&RawDatetime);
      sprintf(ccRawDatetime,"%s", ctime( &RawDatetime ) );
      prFileLog =fopen(ccFileLog, "a+") ;
      if (prFileLog == NULL) {
          printf("\n The file could not be opened");
          exit(1);
      }
      printf("\n SE PUDO ABRIR EL ARCHIVO GLVER34.DATANET.log");
      memset( cRegistro, '\0', LMAX_MSGE) ;
      strncpy(cRegistro,cMessage, sizeof(cRegistro)-1) ;
      fprintf (prFileLog, "%s \n", cRegistro) ;
 
      Rta_RTrim( strAnsw, cRpta );
      memset( cRegistro, '\0', LMAX_MSGE) ;
      strcat( cRegistro, strAnsw );
 
      strcat( cRegistro, " Envio " );
      strcat( cRegistro, ccRawDatetime );
 
      fprintf (prFileLog, "%s \n", cRegistro) ;
      /*
      fwrite(cRegistro, 1 , sizeof(cRegistro) , prFileLog );
      printf("listo ya grabo con fwrite: %s \n", cRegistro ) ;
      */
      fclose(prFileLog ) ;
      printf("finaliza GrabaLogs de tipo void \n") ;
      return;
}
 
/*-------------------------------------------------------------*\
 | Nombre......: SendMailDataNet()                             |
 | Tipo........: void                                          |
 | Autor.......: Golen Von Miller                                 |
 | Fecha.......: 15-05-2009                                    |
 | ............:                                               |
 | Descripcion.: Envia Mails con Errores de DATANET            |
\*-------------------------------------------------------------*/
void SendMailDataNet(char * cSubject, char * cGrupete) {
 
      char  cRmMail[]= "rm -f $A2_IMP/GLVER34.XMAIL.sysout";
      char cDestino[LDES_MAIL]  = {0x00};
      char cComando[LMAX_CMND] = "mail -s \"DATANET ONLINE: " ;
      /*
        char *pAsunto      = cSubject;
        FILE *HandFileErr  = NULL ;
        char cRegError[LMAX_TITU] = {0x00} ;
        int nReturn        = 0;
       */
      char  cFileErrName[LMAX_FILE]={0x00};
      char *pGrupete= cGrupete;
      memset(cDestino,'\0',sizeof(cDestino)-1) ;
      strncpy(cDestino,&pGrupete[0], LDES_MAIL );
      memcpy(cFileErrName, getenv("A2_IMP"), LMAX_FILE );
      strcat(cFileErrName, "/GLVER34.XMAIL.sysout");
      strcat(cComando,cSubject);
      strcat(cComando,"\" ");
      strcat(cComando,cDestino);
      strcat(cComando," < ");
      strcat(cComando,cFileErrName);
      system(cRmMail);
      return;
}
/*-------------------------------------------------------------*\
 | Nombre......: SaveBodyDataNet()                             |
 | Tipo........: void                                          |
 | Autor.......: Golen Von Miller                                 |
 | Fecha.......: 15-05-2009                                    |
 | ............:                                               |
 | Descripcion.: Graba el Cuerpo del Mail para DATANET         |
\*-------------------------------------------------------------*/
void SaveBodyDataNet(char * cStrLine, char * ccAsunto) {
      FILE *HandAttach = NULL ;
      char  cFileErrName[LMAX_FILE]={0x00};
      /*
        char  cTituMailMail[LMAX_TITU]={0x00} ;
       */
      char *pcStrLine = cStrLine ;
      char cSucusal[6]  = {0x00} ;
      char cRaiz[7]     = {0x00} ;
      char cOrdinal[4]  = {0x00} ;
      char cDivisa[4]   = {0x00} ;
      char cImporte[16] = {0x00} ;
      char cTipoOpe[1]  = {0x00} ;
      char cReferen[9]  = {0x00} ;
      char sTipoOpe[16] = {0x00} ;
      int  nComp        = 0;
      memset(cSucusal,'\0',sizeof(cSucusal));
      memset(cRaiz,'\0',sizeof(cRaiz));
      memset(cOrdinal,'\0',sizeof(cOrdinal));
      memset(cDivisa,'\0',sizeof(cDivisa));
      memset(cImporte,'\0',sizeof(cImporte));
      memset(sTipoOpe,'\0',sizeof(sTipoOpe));
      memset(cReferen,'\0',sizeof(cReferen));
      memset(cTipoOpe,'\0',sizeof(cTipoOpe));
      strncpy(cSucusal, &pcStrLine[2], 5);
      strncpy(cRaiz, &pcStrLine[7], 6);
      strncpy(cOrdinal, &pcStrLine[13], 3);
      strncpy(cDivisa, &pcStrLine[16], 3);
      strncpy(cImporte, &pcStrLine[19], 15);
      strncpy(cTipoOpe, &pcStrLine[1], 1);
      strncpy(cReferen, &pcStrLine[37], 8);
      nComp=strncmp(cTipoOpe,"1",1) ;
      if(nComp>0)
          strncpy(sTipoOpe,"Credito",8);
      else
          strncpy(sTipoOpe,"Debito",8);
      memcpy(cFileErrName, getenv("A2_IMP"), LMAX_FILE );
      strcat(cFileErrName, "/GLVER34.XMAIL.sysout");
      HandAttach = fopen(cFileErrName, "a") ;
      if ( HandAttach!=NULL ) {
          fprintf(HandAttach, "  \n") ;
          fprintf(HandAttach, "*****************************************************************: \n") ;
          fprintf(HandAttach, "Error DATANET ONLINE: %s \n", ccAsunto) ;
          fprintf(HandAttach, "*****************************************************************: \n") ;
          fprintf(HandAttach, "Sucusal...........: %s \n", cSucusal) ;
          fprintf(HandAttach, "Raiz..............: %s \n", cRaiz) ;
          fprintf(HandAttach, "Ordinal...........: %s \n", cOrdinal) ;
          fprintf(HandAttach, "Divisa............: %s \n", cDivisa) ;
          fprintf(HandAttach, "Importe...........: %s \n", cImporte) ;
          fprintf(HandAttach, "Tipo Operacion....: %s \n", sTipoOpe) ;
          fprintf(HandAttach, "Referencia........: %s \n\n\n", cReferen) ;
      }
      fclose(HandAttach) ;
      return;
}
 
/*-------------------------------------------------------------*\
 | Nombre......: GetAsuntoMail()                               |
 | Tipo........: void                                          |
 | Autor.......: Golen Von Miller                                 |
 | Fecha.......: 15-05-2009                                    |
 | ............:                                               |
 | Descripcion.: Busca el Asunto del Mail                      |
\*-------------------------------------------------------------*/
void GetAsuntoMail(char * ccSubject, char * ccResp ) {
      char *pccResp       = ccResp;
      char cTituloMail[LMAX_TITU]={0x00};
      int iCodigo       = 0;
      char cCodeRpta[4] = {0x00};
      char cCodigo[100] = {0x00} ;
 
      memset(ccSubject,'\0', LMAX_TITU );
      memset(cCodeRpta,'\0', LMAX_FILE );
      /* strncpy(cCodeRpta, &pccResp[0], 3);  */
      strncpy(cCodeRpta, &pccResp[43], 3);
      iCodigo = atoi(cCodeRpta);
      strncpy(cCodigo, &pccResp[0], 3);
      strcat(cCodigo, " - ") ;
 
      if (iCodigo Equ 110)
           strncpy(cTituloMail,Error110,sizeof(Error110));
      else if (iCodigo Equ 002)
           strncpy(cTituloMail,"Error Interno de Ejecucion de BLOQUEO",38);
      else if (iCodigo Equ 104)
           strncpy(cTituloMail,Error104,sizeof(Error104));
      else if (iCodigo Equ 105)
           strncpy(cTituloMail,Error105,sizeof(Error105));
      else if (iCodigo Equ 106)
           strncpy(cTituloMail,Error106,sizeof(Error106));
      else if (iCodigo Equ 107)
           strncpy(cTituloMail,Error107,sizeof(Error107));
      else if (iCodigo Equ 108)
           strncpy(cTituloMail,Error108,sizeof(Error108));
      else if (iCodigo Equ 113)
           strncpy(cTituloMail,Error113,sizeof(Error113));
      else if (iCodigo Equ 114)
           strncpy(cTituloMail,Error114,sizeof(Error114));
      else if (iCodigo Equ 120)
           strncpy(cTituloMail,Error999,sizeof(Error999));
      else if (iCodigo Equ 999)
           strncpy(cTituloMail,ErrorDef,sizeof(ErrorDef));
      else
           strncpy(cTituloMail,"Error desconocido oo no esperado",40);
 
      strcat(cCodigo, cTituloMail) ;
      strcat(ccSubject, cCodigo) ;
      return;
}
 
/*-------------------------------------------------------------*\
 | Nombre......: GetCodigoRespuesta()                          |
 | Tipo........: void                                          |
 | Autor.......: Golen Von Miller                                 |
 | Fecha.......: 15-05-2009                                    |
 | ............:                                               |
 | Descripcion.: Tipifica el Numero de Error para poder elegir |
 | ............: cual de ellos se debe o no comunicar          |
\*-------------------------------------------------------------*/
int GetCodigoRespuesta(char * cRespuesta) {
      char cCodeRpta[4] = {0x00};
      char *pRespuesta= cRespuesta;
      int nResult     = 0;
 
      /* memset(cCodeRpta,'\0', sizeof(cCodeRpta));    */
      printf("respuesta recibida en (GetCodigoRespuesta())  [%s]\n", cRespuesta );
      memset(cCodeRpta,'\0', 4*sizeof(char) );
 
      /* strncpy(cCodeRpta, &pRespuesta[0], 3);  */
      strncpy(cCodeRpta, &pRespuesta[46], 3);
      /* printf("respuesta capturada %s \n", cCodeRpta ); */
      nResult = atoi(cCodeRpta) ;
      /* printf("respuesta convertida %i \n", nResult );   */
      return nResult ;
}
 
/*-------------------------------------------------------------*\
 | Nombre......: EliminaLogs()                                 |
 | Tipo........: void                                          |
 | Autor.......: Golen Von Miller                                 |
 | Fecha.......: 15-07-2009                                    |
 | ............:                                               |
 | Descripcion.: Elimina el archivo pasado por parametro       |
 | ............:                                               |
\*-------------------------------------------------------------*/
void EliminaLogs(char * cArchivo) {
 
    char cComan[LMAX_TITU] = "rm -f ";
    strcat( cComan, cArchivo );
    system( cComan );
    return;
}
 
/*-------------------------------------------------------------*\
 | Nombre......: Rta_RTrim( char * ccDestino,char a[LMAX_FILE])|
 | Tipo........: void                                          |
 | Autor.......: Golen Von Miller                                 |
 | Fecha.......: 23-02-2022                                    |
 | ............:                                               |
 | Descripcion.: Rutina para quitar los espacios finales de    |
 | ............: un string de tipo respuesta                   |
\*-------------------------------------------------------------*/
void Rta_RTrim( char * ccDestino, char a[LMAX_FILE]) {
 
      char rtrim[LMAX_FILE]= {0x00};
      int i=strlen(a)-1;
      while (i>=0) {
            /*
             | Se quitan espacion TAB y finesde linea enviados por TCP/IP '\n'
             */
            if (a[i]==' '|| a[i]=='\t' || a[i]==0x0d  || a[i]==0x0a ) {
                 rtrim[i]='\0';
                 i = i - 1;
            }
            if (a[i]!=' ' && a[i]!='\t') {
                 break;
            }
      }
      while (i>=0) { rtrim[i]=a[i]; i= i - 1; }
      memcpy(ccDestino, rtrim, LMAX_FILE );
      return;
}
 
/*-------------------------------------------------------------*\
 | Nombre......: rtrim( char * ccDestino, char A[lmax_msge])   |
 | Tipo........: void                                          |
 | Autor.......: Golen Von Miller                                 |
 | Fecha.......: 31-01-2022                                    |
 | ............:                                               |
 | Descripcion.: Rutina para quitar los espacios finales de    |
 | ............: un string de tipo MENSAJE                     |
\*-------------------------------------------------------------*/
void rtrim( char * ccDestino, char a[LMAX_MSGE]) {
 
      char rtrim[LMAX_MSGE]= {0x00};
      int i=strlen(a)-1;
      while (i>=0) {
            /*
             | Se quitan espacion TAB y finesde linea enviados por TCP/IP '\n'
             */
            if (a[i]==' '|| a[i]=='\t' || a[i]==0x0d  || a[i]==0x0a ) {
                 rtrim[i]='\0';
                 i = i - 1;
            }
            if (a[i]!=' ' && a[i]!='\t') {
                 break;
            }
      }
      while (i>=0) { rtrim[i]=a[i]; i= i - 1; }
      memcpy(ccDestino, rtrim, LMAX_MSGE );
      return;
}
 
/*-------------------------------------------------------------*\
 | Nombre......: ltrim( char * ccDestino, char b[LMAX_MSGE])   |
 | Tipo........: void                                          |
 | Autor.......: Golen Von Miller                                 |
 | Fecha.......: 31-01-2022                                    |
 | ............:                                               |
 | Descripcion.: Rutina para quitar los espacios iniciales de  |
 | ............: un string de tipo MENSAJE                     |
\*-------------------------------------------------------------*/
void ltrim( char * ccDestino, char b[LMAX_MSGE]) {
      char ltrim[LMAX_MSGE]= {0x00};
      int i=0,j=0;
      while (b[i]!='\0') {
            if (b[i]!=' ' && b[i]!='\t') {
                break;
            }
            i++;
      }
      while (b[i]!='\0') {
            ltrim[j]=b[i];
            i++;
            j++;
      }
      memcpy(ccDestino, ltrim, LMAX_MSGE );
      return;
}
 
/*-------------------------------------------------------------*\
 | Nombre......: trim( char * ccDestino, char c[LMAX_MSGE])    |
 | Tipo........: void                                          |
 | Autor.......: Golen Von Miller                                 |
 | Fecha.......: 31-01-2022                                    |
 | ............:                                               |
 | Descripcion.: Rutina para quitar los espacios iniciales y   |
 | ............: un string de tipo MENSAJE                     |
\*-------------------------------------------------------------*/
void trim( char * ccDestino, char c[LMAX_MSGE]) {
      char rtrim[LMAX_MSGE]= {0x00};
      int i=strlen(c)-1;
      while (i>=0) {
            if (c[i]==' '|| c[i]=='\t') {
                 rtrim[i]='\0';
            }
            if (c[i]!=' ' && c[i]!='\t') {
                 break;
            }
            i = i - 1;
      }
      while (i>=0) {
            rtrim[i]=c[i];
            i = i - 1;
      }
      char ltrim[LMAX_MSGE]= {0x00};
      int j=0,k=0;
      while (rtrim[j]!='\0') {
            if (rtrim[j]!=' ' && rtrim[j]!='\t') {
                 break;
            }
            j++;
      }
      while (rtrim[j]!='\0') {
            ltrim[k]=rtrim[j];
            j++;
            k++;
      }
      char trim[LMAX_MSGE];
      strcpy (trim, ltrim);
      memcpy(ccDestino, trim, LMAX_MSGE );
      return;
}
 
/*-------------------------------------------------------------*\
 | Nombre......: AvisoToCompliance( char * cStrLine )        |
 | Tipo........: void                                          |
 | Autor.......: Golen Von Miller                                 |
 | Fecha.......: 15-05-2009                                    |
 | ............:                                               |
 | Descripcion.: Graba el Cuerpo del Mail a compliance con     |
 | ............: Detalles                                      |
\*-------------------------------------------------------------*/
void AvisoToCompliance( char * cStrLine ) {
 
      FILE *HandAttach = NULL ;
      char  ccCompliance[LMAX_FILE]={0x00};
 
      char *pcStrLine = cStrLine ;
 
      char *ccA2imp = getenv("A2_IMP");
      char *iaminprod = getenv("I_AM_IN_PROD");
 
      char cSucursal      [5]  = {0x00};
      char cRaiz          [6]  = {0x00};
      char cOrdinal       [3]  = {0x00};
      char cDivisa        [3]  = {0x00};
      char cImporte       [15] = {0x00};
      char cProcede       [8]  = {0x00};
      char cOrdenan       [29] = {0x00};
      char cbenefic       [29] = {0x00};
      char cNameDeta[16] = {0x00};
 
      char ccEmail[280] = "mailx -s \"Operacion demorada, aviso a Compliance: detalles\" ";
      /*  char ccdesti[] = "\"dl.ar.compliance.office@au.korean.com,dl.ar.bo.client.services@au.korean.com,pepe.argento@au.korean.com\" < "; */
      char ccdesti[] = "\"dl.au.develop@au.korean.com\" < ";
 
      memset(cNameDeta,'\0', sizeof(cNameDeta));
      memset(cSucursal,'\0', sizeof(cSucursal));
      memset(cRaiz    ,'\0', sizeof(cRaiz    ));
      memset(cOrdinal ,'\0', sizeof(cOrdinal ));
      memset(cDivisa  ,'\0', sizeof(cDivisa  ));
      memset(cImporte ,'\0', sizeof(cImporte ));
      memset(cProcede ,'\0', sizeof(cProcede ));
      memset(cOrdenan ,'\0', sizeof(cOrdenan ));
      memset(cbenefic ,'\0', sizeof(cbenefic ));
 
      memset(ccCompliance,'\0', sizeof(ccCompliance));
      memcpy(cNameDeta, &pcStrLine[2],17 );
 
      cNameDeta[sizeof(cNameDeta)] = '\0';
 
      sprintf (ccCompliance, "%s/GLVER34.%sZ.sysout", ccA2imp, cNameDeta);
 
      memcpy(cSucursal,&pcStrLine[2],5 );
      memcpy(cRaiz    ,&pcStrLine[7],6 );
      memcpy(cOrdinal ,&pcStrLine[13],3 );
      memcpy(cDivisa  ,&pcStrLine[16],3 );
      memcpy(cImporte ,&pcStrLine[19],15 );
      memcpy(cProcede ,&pcStrLine[51],8 );
      memcpy(cOrdenan ,&pcStrLine[145],29 );
      memcpy(cbenefic ,&pcStrLine[174],29 );
 
      cSucursal[sizeof(cSucursal)] = '\0';
      cRaiz    [sizeof(cRaiz    )] = '\0';
      cOrdinal [sizeof(cOrdinal )] = '\0';
      cDivisa  [sizeof(cDivisa  )] = '\0';
      cImporte [sizeof(cImporte )] = '\0';
      cProcede [sizeof(cProcede )] = '\0';
      cOrdenan [sizeof(cOrdenan )] = '\0';
      cbenefic [sizeof(cbenefic )] = '\0';
 
      HandAttach = fopen(ccCompliance, "w") ;
      if(HandAttach!=NULL) {
 
          fprintf(HandAttach, "  \n") ;
          fprintf(HandAttach, "***************************************************************** \n") ;
          fprintf(HandAttach, "Detalles \n") ;
          fprintf(HandAttach, "***************************************************************** \n") ;
          fprintf(HandAttach, "Sucusal...........: %s \n", cSucursal  ) ;
          fprintf(HandAttach, "Raiz..............: %s \n", cRaiz      ) ;
          fprintf(HandAttach, "Ordinal...........: %s \n", cOrdinal   ) ;
          fprintf(HandAttach, "Divisa............: %s \n", cDivisa    ) ;
          fprintf(HandAttach, "Importe...........: %s \n", cImporte   ) ;
          fprintf(HandAttach, "Procedencia.......: %s \n", cProcede   ) ;
          fprintf(HandAttach, "Ordenante.........: %s \n", cOrdenan   ) ;
          fprintf(HandAttach, "Beneficiario......: %s \n", cbenefic   ) ;
          fclose(HandAttach) ;
 
          if ( strcmp(iaminprod, "Y")==0)
               strcat(ccdesti, "\"dl.ar.kanea.off@au.korean.com,dl.arjoclienta.serv@au.korean.com,pepe.argento@au.korean.com\" < ");
          else
               strcat(ccdesti, "\"dl.au.develop@au.korean.com\" < ");
 
          strcat(ccEmail,  ccdesti);
          strcat(ccEmail,  ccCompliance );
          /* printf("este es el mail: %s \n", ccEmail);   */
          system( ccEmail );
 
      } else {
          fclose(HandAttach) ;
      }
      return;
}
 
/*-------------------------------------------------------------*\
 | Nombre......: GrabaLogs()                                   |
 | Tipo........: void                                          |
 | Autor.......: Golen Von Miller                                 |
 | Fecha.......: 15-05-2009                                    |
 | ............:                                               |
 | Descripcion.: Graba Logs de DATANET                         |
 | ............: Mensaje y Respuesta                           |
 | MODIFICACION: Golen Von Miller       ( 24-08-2016 )            |
 | ............: SE EXTIENDE EL LARGO DEL REGISTRO DE LOGS A   |
 | ............: 240 CARACTERES.                               |
\*-------------------------------------------------------------*/
void GrabaDatanetLog(char * cMessage, char * cRpta) {
 
      time_t RawDatetime;
      struct tm * time_info;
      char   ccRawDatetime[26] = {0x00};
 
      char   ccFileDataNet[LMAX_FILE] = {0x00} ;
      char   strAnsw[70] = {0x00};
 
      FILE *prFileLog = NULL ;
      char cRegistro[LMAX_MSGE]={0x00} ;
 
      memset(ccFileDataNet, '\0', LMAX_FILE);
      memcpy(ccFileDataNet, getenv("A2_IMP"), LMAX_FILE );
      strcat(ccFileDataNet, "/GLVER34.DATANET.log" );
 
      memset(ccRawDatetime, '\0', 26);
      time(&RawDatetime);
      time_info = localtime(&RawDatetime);
      strftime(ccRawDatetime, 26, "%D %H:%M:%S", time_info);
      /*
        sprintf(ccRawDatetime,"%s", ctime( &RawDatetime ) );
       */
 
      prFileLog =fopen(ccFileDataNet, "a+") ;
      if (prFileLog == NULL) {
         printf("\n The file %s could not be opened", ccFileDataNet);
         exit(1);
      }
      fprintf (prFileLog, "[%s]\n [%s]  [%s]\n", cMessage, cRpta, ccRawDatetime) ;
      /*
       | fwrite(strAnsw, 1 , sizeof(strAnsw) , prFileLog );
       */
      fclose(prFileLog ) ;
 
      return;
}
 
/*-------------------------------------------------------------*\
 | Nombre......: GrabaTCPULog()                                |
 | Tipo........: void                                          |
 | Autor.......: Golen Von Miller                                 |
 | Fecha.......: 15-05-2009                                    |
 | ............:                                               |
 | Descripcion.: Graba los datos del cliente IP, Fecha, Hora   |
 | ............: Datos recibidos y Datos enviados              |
 | MODIFICACION: Golen Von Miller       ( 24-08-2016 )            |
 | ............: SE EXTIENDE EL LARGO DEL REGISTRO DE LOGS A   |
 | ............: 240 CARACTERES.                               |
\*-------------------------------------------------------------*/
void GrabaTCPULog(char * cMessage) {
 
      char   ccFileTcpu[LMAX_FILE] = {0x00} ;
      char   strAnsw[70] = {0x00};
      FILE *prFileLog = NULL ;
      char cRegistro[LMAX_MSGE]={0x00} ;
 
      memset(ccFileTcpu, '\0', LMAX_FILE);
      memcpy(ccFileTcpu, getenv("A2_IMP"), LMAX_FILE );
      strcat(ccFileTcpu, "/JYAM89.TCPU89.log" );
      prFileLog =fopen(ccFileTcpu, "a+") ;
      if (prFileLog == NULL) {
          printf("\n The file %s could not be opened", ccFileTcpu);
          exit(1);
      }
      fprintf (prFileLog, "%s \n", cMessage) ;
      fclose(prFileLog ) ;
      return;
}
 
/*-------------------------------------------------------------*\
 | Nombre......: GrabaLogJyam11()                              |
 | Tipo........: void                                          |
 | Autor.......: Golen Von Miller                                 |
 | Fecha.......: 15-05-2009                                    |
 | ............:                                               |
 | Descripcion.: Graba un log para el job jyam11 que hara      |
 | ............: controles para el area de cumplimiento        |
 | MODIFICACION: Golen Von Miller       ( 24-12-2022 )            |
 | ............:                                               |
 | ............:                                               |
\*-------------------------------------------------------------*/
void GrabaLogJyam11(char * cMessage ) {
 
      FILE *prHandFile = NULL ;
      char ccRJyam11[LMAX_MSGE]={0x00} ;
 
      char cJyam11Log[LMAX_FILE]  = {0x00} ;
 
      memset(cJyam11Log, '\0', LMAX_FILE);
      memcpy(cJyam11Log, getenv("A2_IMP"), LMAX_FILE );
      strcat(cJyam11Log, "/GLVER34.SOLO120.log" );
 
      prHandFile = fopen(cJyam11Log, "a+") ;
 
      strcat(ccRJyam11,cMessage);
      fprintf(prHandFile, "%s\n", ccRJyam11) ;
 
      fclose(prHandFile ) ;
      printf("Se Grabo le mensaje que dio 120 \n\n") ;
      return;
}
 
/*--------------------------------------------------------------------*\
 | Nombre......: GetPortOfListen()
 | Autor.......: Golen Von Miller
 | Fecha.......: 06/11/2024
 | Descripcion.:
 | ............:
 | ............:
 | ............:
\*--------------------------------------------------------------------*/
int GetPortOfListen() {
      char *iaminprod = getenv("I_AM_IN_PROD");
      int inPort = 0;
      if ( strcmp(iaminprod, "Y")==0)
           inPort=1917;
      else
           inPort=1907;
      return inPort;
}
/*------------------------------------------------------------------------*\
| Nombre......: void QuitarEndOfLine( char *cadenaOriginal );
| Tipo........: void
| Autor.......: Golen Von Miller
| Fecha.......: 14-03-2025
| ............:
| Descripcion.: Quitar el ASCII 10 de una cadena
\*------------------------------------------------------------------------*/
void QuitarEndOfLine( char *cadenaOriginal ) {
     char nuevaCadena[256] = "";
     char caracterAQuitar = '\n';
     int i, j = 0;
     for (i = 0; cadenaOriginal[i] != '\0'; i++) {
          if (cadenaOriginal[i] != caracterAQuitar) {
               nuevaCadena[j++] = cadenaOriginal[i];
          }
     }
     nuevaCadena[j] = '\0';
     memset(cadenaOriginal, '\0', sizeof(cadenaOriginal)-1);
     strcpy(cadenaOriginal, nuevaCadena);
}
/*------------------------------------------------------------------------*\
| Nombre......: void QuitarExtChar( char *cadenaOriginal );
| Tipo........: void
| Autor.......: Golen Von Miller
| Fecha.......: 14-03-2025
| ............:
| Descripcion.: Quitar el ASCII 03 o ETX de una cadena
\*------------------------------------------------------------------------*/
void QuitarExtChar( char *cadenaOriginal ) {
     char nuevaCadena[256] = "";
     char caracterAQuitar = '\x03';
     int i, j = 0;
     for (i = 0; cadenaOriginal[i] != '\0'; i++) {
          if (cadenaOriginal[i] != caracterAQuitar) {
               nuevaCadena[j++] = cadenaOriginal[i];
          }
     }
     nuevaCadena[j] = '\0';
     memset(cadenaOriginal, '\0', sizeof(cadenaOriginal)-1);
     strcpy(cadenaOriginal, nuevaCadena);
}
 
/*-------------------------------------------------------------*\
 | Nombre......: getSubString(char *str, char *subStr, int start, int length)
 | Tipo........: void
 | Autor.......: Golen Von Miller
 | Fecha.......: 09-01-2025
 | ............:
 | Descripcion.:
\*-------------------------------------------------------------*/
void getSubString(char *str, char *subStr, int start, int length) {
    int i;
    for (i = 0; i < length && str[start + i] != '\0'; i++) {
        subStr[i] = str[start + i];
    }
    subStr[i] = '\0';
}
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
0
Comentar