Results 1 to 2 of 2

Thread: Using DSNTIAUL

  1. #1
    Join Date
    Nov 2007
    Posts
    1

    Unanswered: Using DSNTIAUL

    I am trying to run a query thru JCL using the DSNTIAUL option in jcl.
    My query is running fine except that a char '' is getting appended in the begining . Please let me know how can I eliminate this .

    My query looks like this :
    Select 'PAVAN'||empn0||'|'||deptno||'|'
    from emp,dept
    where emp_status='ACTIVE'

    the o/p is as follows :

    PAVAN1234|SALES|

    How do I eliminate '' from my o/p?

    The JCL I am using is

    //STEP10 EXEC PGM=IKJEFT01,
    // DYNAMNBR=20,
    // COND=(0,NE)
    //*
    //SYSTSPRT DD SYSOUT=*
    //SYSTSIN DD *
    DSN SYSTEM(DSN)
    RUN PROGRAM(DSNTIAUL) PLAN(DSNTIAUL) PARMS('SQL')
    /* END OF INPUT
    //SYSPRINT DD SYSOUT=*
    //SYSUDUMP DD SYSOUT=*
    //*
    //SYSREC00 DD DSN=pavan.DUMP.Output,
    // DISP=(NEW,CATLG,DELETE),
    // UNIT=SYSDA,
    // SPACE=(CYL,(200,50),RLSE),
    // DCB=(RECFM=FB,LRECL=400,BLKSIZE=0)
    //SYSPUNCH DD DUMMY
    //*
    //SYSIN DD *
    above query
    /*

    Thanks in advance!!
    Pavan.

  2. #2
    Join Date
    Dec 2005
    Posts
    273
    your SELECT results in a column of type VARCHAR. That means, a two-byte length indicator preceeds your result.

    Try this:

    Select CAST( 'PAVAN'||empn0||'|'||deptno||'|' AS CHAR(xxx) )
    from emp,dept
    where emp_status='ACTIVE'

    where xxx is the length of your result.

    by the way:
    you use an inner join, but there is no join criteria in your where-clause.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •