Reading Spool files from AS400 through JAVA Applications

Hi,
i am trying to read spool fiels through my java application with the help of jt400.jar files,which is developed by IBM.When i try to display the content of the spool file the result is look like this and give some ideas to come out from these
problems.
thanks in advance
selvin
--- 4- 4++++�+-+@z 4++-_��++_� 4+3@+@+@_���������@M_�����?�] 4+
s+-�+@z 4+@@@@� � 4+__++@+-@z 4+___ 4+++++++ 4+s--�+@z 4+z_a_�a___� � 4+:-
?��@z 4+B__a_�a___� 4+s�+++@z 4+|��z_�z_� � 4+:-�?���@z 4+C__� 4+G` 4+I___ �� 4+
-�?��� 4+-�?��� 4+B���?�@+�M�] 4+T@@���?� 4+j���?�@_?��� � 4+@+��� 4+@+?�� 4
B��@����� 4+T+�?����� 4+k��@_�?��� � 4+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~~~~~~~~~~~~~~ � 4+__� 4+
---++ 4+B@@@@_ 4+Q@@@@@@@@@@_ 4+j@@@@@@@@@@@@@@@@@@K__ � � 4+___ 4+
---_++++--+ 4+B@@@@_ 4+Q@@@@@_�k___ 4+j@@@@@@@@@@@@_�k_�_K__ � � 4+___ 4+
---++++� 4+B@@@@� 4+Q@@@@@�k___ 4+j@@@@@@@@@@@@__k___K__ � � 4+___ 4+
----- 4+B@@@@_ 4+Q@@@@@@@@@@_ 4+j@@@@@@@@@@@@@@@@@@K__ � � 4+@@@@@@@@@@@@@@@@@@
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ � 4+'�+--@��-+@z 4+C@@@@_ 4+R@@@@@�_k___ 4+
k@@@@@@@@@@@@��k��_K__ � 4+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@@@@@@@~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

If you were expecting the spool file to be translated to ASCII with carriage returns, line feeds, and form feeds, here is the magical piece of code:
SpooledFile splf = new SpooledFile(sys, splfName, splfNum, jobName, jobUser, jobNum);
PrintParameterList pl = new PrintParameterList();
pl.setParameter(SpooledFile.ATTR_MFGTYPE, "*WSCST");
pl.setParameter(SpooledFile.ATTR_WORKSTATION_CUST_OBJECT, "/QSYS.LIB/QWPDEFAULT.WSCST");
InputStream in = splf.getTransformedInputStream(pl);
For reasons not immediately clear to me, the first character in the file appears to be a null byte (hex 0). I also believe that CRs and LFs only appear as needed to return to the beginning of the line (CR) and the feed one line (LF). It is permissible for example to have <data><CR><LF><LF><LF> (i.e. feed three lines). I also assume that <data><CR><data><CR><LF> would result in overprinting (missing line feed). I have even seen <data><CR><CR>, and I assume the second CR should be ignored.
I have not exhaustively tested these scenarios, but from some of the problems we've had, the above description seems like a reasonable way to think about the data stream

Similar Messages

  • How can I execute a  .bat  file from inside a java application

    I have a .bat file which contains an executable file(.exe) and some input and output file names. What commands can I use to execute this bat file from my java application.

    After raeding tkleisas' reply; i am trying to invoke another application (which can be invoked from the command line) by using a batch file and trying Runtime.exec for executing a batch file.
    My current code is:
    Runtime runtime = Runtime.getRuntime();
    Process trialProcess;
    trialProcess = runtime.exec("cmd.exe /C start C:\\guns.bat /B");
    And my guns.bat looks like:
    cd C:\CALPUFF
    echo trial
    start calpuff.exe CALPUFF.INP
    This is not working for me and i get the following in the error stream of the trialProcess:
    Error :
    The system cannot execute the specified program.
    Process finished with exit code 1
    Has anyone come across something like this and know what's wrong with this one??
    thnx

  • Read sound file from disk in Java

    Write a simple application that reads a sound file from disk (use a Clip). Play the sound backwards by arranging the byte arrays/frames in the reverse order.
    Please I need an explanation of every step.
    Get some Duke Dollars for your help.

    Hi,
    When execute this code, I see this: "[Ljava.io.File;@111f71".   
    How I can see the name of the File, and How I can run a program with one by one from the files reader in a parameter ???
      Thank's.
       Hervey P.                                                                                                                                                                                                                                                                                                                                                                                                                                                               

  • File Upload from a desktop java application

    Hi,
    what I want to achieve is, to upload a pipe-delimited text file from my desktop java application to my hosting server, and then on the server, I have a PHP page that would parse this file and insert records to the database.
    so, on the server, I can enable write access on the folder which I want to upload the file to,
    but how do I upload a file from my desktop application.
    Thanks

    HttpURLConnection conn = (HttpURLConnection) _url.openConnection();this code open a http connection, and what is left is to fill in http protocol things (e.g. content type, content length, POST/PUT or whatever method...etc). after you set the correct request header then open a output stream and pass your files and flush the connection then close it.... in theory (never tried sending files, only done handling POST http form requests with it but it shouldn't be too much different when it is http protocol)
    you may want to install Fiddler2 into your browser, it can filter out the browser outgoing and incomign information and you can take a little read in their header and see how they interact with each other

  • How to view file from vss using java Commandline

    Hi To ALL,
    I wanted to view a file from vss through java code.
    By using the folowing code,i could able to get vss file in to local folder.
    Runtime.getRuntime().exec
    ("cmd /c ss Get $/Mywork/Myfile.java -GLC:/New");
    But i wanted to view file from vss using java code.
    any one please help me..
    Thanks in advance.........

    As always, Google is your friend.
    Follow the bouncing link.
    http://www.google.com/search?hl=en&q=VisualSourceSafe+%2B+Java+API
    PS.

  • Possible to create a JAR file from within a java app?

    Is it possible to create a jar file from within a java application?
    Can it be done more elegantly than by spawning-off another
    process with the Runtime and exec() portions of the api?
    Thanks
    Scott

    Thanks! I was mislead by the API notes for java.util.jar:
    The JarOutputStream class is used to write the contents
    of a JAR file to any output stream.
    I was looking for a class or method to make jar files.
    Seems this is it ;)
    Thanks
    Scott

  • Opening a binary data file with a local java application from a weblink...

    I don't know if this is the right forum for my query, but I would like to be able to click on a data file from a download link on a webpage and be able to have the file "open" into the java application that processes the particular file (as opposed to selecting the "save to disk" option or having the browser display a bunch of funky characters). If the application is not already running, have an instance start up and process the data file and display the information. What steps would I need to take to get this to happen? The application is executed in a windows environment through executing a .bat file and not an executable .jar file. Any thoughts? TIA!

    This is entirely a matter of configuring the Windows file associations so that files with that extension are started using your designated process. Depending on the particulars you may be able to establish the association from the context (right-click) menu, or you may need to use Folder Options rom the Control Panel.
    In any case, this is a not a Java question, but Windows; if further help is needed you should go to a Windows help site.

  • FM to read XML files from Application server in ECC5.0

    Hi All,
    We need to pick up an XML file from Application server/FTP server. The requirement is to parse the XML file and process it to create material master. SAP provides standard function modules to read XML files.
    Now we need to read the XML file contents of MM01 and upload into SAP Data Base through BAPI
    I need to know about the Function modules to read XML files from Application Server and also about the FM's that will update the Date base tables with the data obtained form XML files.
    Regards
    Prathima

    Parsing XML data:
    http://help.sap.com/saphelp_nw04/helpdata/en/86/8280ba12d511d5991b00508b6b8b11/frameset.htm
    or alternatively check out ABAP online help for "CALL TRANSFORMATION".
    For creating the material master look at BAPI_STANDARDMATERIAL_CREATE.
    Thomas

  • I want read PDF file from SAP directory and create a spool request or print

    Hi all,
    I want read PDF file from SAP directory and create a spool request or print the pdf through SAP. Can any body  help me in this.
    Also please write to me if its possible to open PDF from SAP directory to adobe pdf reader.
    Thanks in advance,
    Sunny

    Hi Sunny,
    Check these links.
    http://www.sapdevelopment.co.uk/reporting/rep_spooltopdf.htm
    http://www.erpgenie.com/sap/abap/pdf_creation.htm
    http://www.geocities.com/mpioud/Z_EMAIL_ABAP_REPORT.html
    http://www.thespot4sap.com/Articles/SAP_Mail_SO_Object_Send.asp
    http://www.sapdevelopment.co.uk/reporting/email/attach_xls.htm
    Hope this resolves your query.
    Reward all the helpful answers.
    Regards

  • Regarding Reading the file from Application Server

    Hi,
    I am trying to read data from Application Server but due to special characters it is getting dumped out.
    US24,Q,Acero (Carbon),AA,0010,0001,01,Ver Mir para dimension#
    US24,Q,Acero (Carbon),AA,0010,0002,01,Area rectificada sin da#os ra
    US24,Q,Acero (Carbon),AA,0010,0003,01,Ver Mir para dimension#
    US24,Q,Acero (Carbon),CD,0010,0001,01,ITPE Soken para verificacion
    US24,Q,Acero (Carbon),CD,0010,0010,01,No se permite desprendimiento
    US24,Q,Acero (Carbon),CD,0010,0002,01,"Vernier, cinta metrica"#
    In the last line it is going into dump due to special character ".
    Please suggest.
    Thanks
    Priyanka.

    Hi,
    You can check the mode in which you are reading the file
    from application server that is
    Open Dataset in Binary or Text Mode.
    Hope it helps
    Regards
    Mansi

  • Error while reading excel file from application server into internal table.

    Hi experts,
    My requirement is to read an excel file from application server into internal table.
    Hence I have created an excel file fm_test_excel.xls in desktop and uploaded to app server using CG3Z tcode (as BIN file type).
    Now in my program I have used :
    OPEN DATASET v_filename FOR INPUT IN text mode encoding default.
    DO.
    READ DATASET v_filename INTO wa_tab.
    The statement OPEN DATASET works fine but I get a dump (conversion code page error) at READ DATASET statement.
    Error details:
    A character set conversion is not possible.
    At the conversion of a text from codepage '4110' to codepage '4103':
    - a character was found that cannot be displayed in one of the two
    codepages;
    - or it was detected that this conversion is not supported
    The running ABAP program 'Y_READ_FILE' had to be terminated as the conversion
    would have produced incorrect data.
    The number of characters that could not be displayed (and therefore not
    be converted), is 445. If this number is 0, the second error case, as
    mentioned above, has occurred.
    An exception occurred that is explained in detail below.
    The exception, which is assigned to class 'CX_SY_CONVERSION_CODEPAGE', was not
    caught and
    therefore caused a runtime error.
    The reason for the exception is:
    Characters are always displayed in only a certain codepage. Many
    codepages only define a limited set of characters. If a text from a
    codepage should be converted into another codepage, and if this text
    contains characters that are not defined in one of the two codepages, a
    conversion error occurs.
    Moreover, a conversion error can occur if one of the needed codepages
    '4110' or '4103' is not known to the system.
    If the conversion error occurred at read or write of  screen, the file
    name was '/usr/sap/read_files/fm_test_excel.xls'. (further information about
    the file: "X 549 16896rw-rw----201105170908082011051707480320110517074803")
    Also let me know whether this is the proper way of reading excel file from app server, if not please suggest an alternative .
    Regards,
    Karthik

    Hi,
    Try to use OPEN DATASET v_filename FOR INPUT IN BINARY mode encoding default. instead of OPEN DATASET v_filename FOR INPUT IN text mode encoding default.
    As I think you are uploading the file in BIN format to Application server and trying to open text file.
    Regards,
    Umang Mehta

  • What are the commands available to read a file from application server and

    What are the commands available to read a file from application server and store the file into an internal table?

    Hi,
    To read a file from an Application Server to an Object there is a command in ABAP called <b>READ DATASET</b>. After that file is transported to that object you have to do a loop and put that data in an Internal Table.
    This statement exports data from the file specified in dset into the data object dobj. For dobj, variables with elementary data types and flat structures can be specified. In Unicode programs, dobj must be character-type if the file was opened as a text file.
    For dset, a character-type data object is expected - that is, an object that contains the platform-specific name of the file. The content is read from the file starting from the current file pointer. After the data transfer, the file pointer is positioned after the section that was read. Using the MAXIMUM LENGTH addition, the number of characters or bytes to be read from the file can be limited. Using ACTUAL LENGTH, the number of characters or bytes actually used can be determined.
    In a Unicode program, the file must be opened with an arbitrary access type; otherwise, an exception that cannot be handled will be triggered.
    If the file has not yet been opened in anon-Unicode program, it will be implicitly opened as a binary file for read access using the statement
    OPEN DATASET dset FOR INPUT IN BINARY MODE.
    . If a non-existing file is accessed, an exception that can be handled can be triggered.
    Influence of Access Type
    Files can be read independently of the access type. Whether data can be read or not depends solely on the position of the file pointer. If the latter is at the end of the file or after the file, no data can be read and sy-subrc will be set to 4.
    Influence of the Storage Type
    The import function will take place irrespective of the storage type in which the file was opened with the statement OPEN DATASET.
    If the file was opened as a text file or as a legacy text file, the data is normally read from the current position of the file pointer to the next end-of-line marking, and the file pointer is positioned after the end-of-line marking. If the data object dobj is too short for the number of read characters, the superfluous characters and bytes are cut off. If it is longer, it will be filled with blanks to the right.
    If the file was opened as a binary file or as a legacy-binary file, as much data is read that fits into the data object dobj. If the data object dobj is longer than the number of exported characters, it is filled with hexadecimal 0 on the right.
    If the specified storage type makes conversion necessary, this is executed before the assignment to the data object dobj. Afterwards, the read data is placed, byte by byte, into the data object.
    System Fields
    sy-subrc Meaning
    0 Data was read without reaching end of file.
    4 Data was read and the end of the file was reached or there was an attempt to read after the end of the file.
    Thanks,
    Samantak.
    <b>Rewards points for useful answers.</b>

  • Reading XML file from application server and  put into internal table-4.6C

    Dear All,
    Is there any way of reading XML file from application server to SAP? I am using 4.6C. Function module SCMS_STRING_TO_XSTRING function module is not available. Please suggest.
    Thanks and regards,
    Atanu

    Hi Atanu!
    Simply use the XSLT transformation 'ID'.
    FIELD-SYMBOLS <ls_result> TYPE ANY.
    CREATE DATA lref_data TYPE (your_structure).
    ASSIGN lref_data->* TO <ls_result>.
    CALL TRANSFORMATION id
                        SOURCE XML xmlstr
                        RESULT result = <ls_result>.
    "xmlstr" contains your XML file. Just read it into it via standard I/O operations. "<ls_result>" will contain your DDIC formatted content.
    Best regards
    Torsten

  • Not recognizing # while reading the file from application server

    Hi
    I am reading a file from application server. While reading into internal table with read statement the last field in each record is filling with hash symbol in the last digit. If I write any if condition with HASH symbol its not going inside the if condition, means its not recognizing as hash may be its internally treating as some other. I need to remove the hash from that field. How I can do that.
    Thanks,
    kishore

    I faced exact situation. Yes, internally its treated as some other special character. What i did was, becuase hash symbol was always coming at the end...i created a dummy field in my internal table so that it will not interfere with my actual data. When i see the data in my internal table, the hash always falls in the last field (dummy) which i will ignore. I could not get solution to remove this hash so i adopted this approach and it worked!!
    Hope it helps,
    SKJ

  • How to open Adobe Reader file from another native IOS application?

    There is an existing thread, but I want to re-open it because I think this is an important feature that we need badly.  I was wondering if there is any plan to add this feature so we can open PDFs directly into Adobe from the web / other apps.
    How to open Adobe Reader file from another native IOS application?
    Basically, we just want to use a custom URL scheme to open a specific document in the App.  Currently, this only opens the app but does not load the file.
    APB

    Not to hijack the conversation but I can explain why this would be useful for both the above case and another.
    What I believe Pavel is talking about is setting up a "URL Scheme" for the Adobe Acrobat iOS application so that you can easily open a PDF specifically in Adobe Acrobat iOS from other native applications and even from web applications opened within Safari. This is particularly useful if your application requires some of the specific features in Adobe Reader iOS to grant them the best experience possible and you want to encourage this.
    Another case: If you're using Adobe Livecycle's document security modules (that encrypts PDF files so that Adobe Acrobat must "phone home" to decrypt and view the document), these PDF's can only be viewed inside the Adobe Acrobat application and appear as blank in most other PDF readers. Having a URL scheme allows your application utilising this functionality to have a 1 click step to view the PDF rather than the current non-user friendly process:
    - Within Safari, touch the PDF link (appears as blank in the default Safari PDF reader, which in itself is confusing)
      - Touch "Open in..."
      - Touch "Adobe Acrobat"
    We have an immediate need for this functionality for the example above. I can resubmit it in a separate post if necessary.

Maybe you are looking for

  • IPhone not syncing Contacts to Address Book

    I noticed that my iPhone (both original iPhone and iPhone 3G) was not syncing contacts with Address Book. I tried to Reset Sync History in iSync, and when I have tried to replace the contacts on iPhone under the Advanced options, I lose all my contac

  • Loading a class dynamically to classpath

    I have a class object for my .class file. It thougth it would be loaded to the classpath dynamcially by resolveClass(Class c), but still i am not able to add my class to the VM's classpath. Can anybody help, Thanks in advance Amir

  • Controlling multiple devices theory

    I have an application theory I would like to get some input on.  Take an application like a Servo Engine.vi, it controls communication with the servo and dequeues any servo commands from the main.vi to control the servo.  Now my question is if you ha

  • To where are Software Updater file downloaded?

    I have a software package to update on two computers. The computers are the same and I need to update software on both computers. However, where I live we pay for each megabyte downloaded so I would like to update the first computer then copy the upd

  • Why does the iPhone 4 need to send an SMS to activate FaceTime when the iPad 2 doesn't?

    Hi there. I keep wondering why iPhone 4 need to send a international SMS to activate FaceTime when the iPad 2 doesn't? It cost's 2,50 dkr ($0.48) every time it does that. I have a mobile subscription where i get 5 hours talk time, Free SMS, Free MMS,