Page 1 of 1

check char value in OUTFIL

PostPosted: Tue Sep 28, 2010 4:49 pm
by richagoyal
hi ,
i am facing a problem in OUTFIL, i am trying to put a query in the output dataset from jcl in the string. i am able to create the dataset with required query but i want to check SF_SUB_ACCT_TYPE = L and it is a char field ,but not able to check .

 //SORT009  EXEC PGM=SORT                         
//SYSOUT   DD  SYSOUT=*                           
//SORTIN   DD  DSN=CS.DH6D.DATE.B2.BATQ110,DISP=SH
//SORTOUT  DD  DSN=CS.DH6D.DEL.CURDSF,           
//             DISP=(,CATLG,DELETE),             
//             DCB=(RECFM=FB,LRECL=100),         
//             SPACE=(100,(1,1),RLSE),AVGREC=K   
//SYSIN    DD  *                                 
 SORT FIELDS=COPY                                 
 OUTFIL BUILD=(C'SELECT * FROM DSF_SUB_FACILITY ',
               C'WHERE SF_YEAR_MTH = ',           
               52:53,6,                           
               C' AND SF_SUB_ACCT_TYPE =',C'L',   
               C'; COMMIT; ',                     
               09C' ')                           

how can i check for char value while building the string through outfil ?

Re: check char value in OUTFIL

PostPosted: Tue Sep 28, 2010 5:05 pm
by richagoyal
Expected output :

SELECT * FROM DSF_SUB_FACILITY WHERE SF_YEAR_MTH = 200910 AND SF_SUB_ACCT_TYPE ='L'; COMMIT;

output coming with above query :
SELECT * FROM DSF_SUB_FACILITY WHERE SF_YEAR_MTH = 200910 AND SF_SUB_ACCT_TYPE = L; COMMIT;

when i submit this query its failing as SF_SUB_ACCT_TYPE is char field .

Re: check char value in OUTFIL

PostPosted: Tue Sep 28, 2010 8:24 pm
by NicC
Probably have to double quote (i.e. use 2 single quotes) the L. Check the documentation for quoted strings.

Re: check char value in OUTFIL

PostPosted: Wed Sep 29, 2010 2:40 am
by Frank Yaeger
richagoyal,

Use this DFSORT OUTFIL statement:

  SORT FIELDS=COPY                                           
  OUTFIL BUILD=(C'SELECT * FROM DSF_SUB_FACILITY ',         
               C'WHERE SF_YEAR_MTH = ',                     
               52:53,6,                                     
               C' AND SF_SUB_ACCT_TYPE =',C'''L''',         
               C'; COMMIT; ',                               
               100:X)                                       

Re: check char value in OUTFIL

PostPosted: Wed Sep 29, 2010 2:35 pm
by richagoyal
Thanks Frank , its working !