MVSFORUMS.com Forum Index MVSFORUMS.com
A Community of and for MVS Professionals
 
 FAQFAQ   SearchSearch   Quick Manuals   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

How to get selected records giving file as input
Goto page 1, 2  Next
 
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Database
View previous topic :: View next topic  
Author Message
js01
Beginner


Joined: 13 Oct 2005
Posts: 84
Topics: 32
Location: INDIA

PostPosted: Tue Aug 15, 2006 1:33 pm    Post subject: How to get selected records giving file as input Reply with quote

All,

I have a file which is having some key data
using this file as an input I should get selected records depending on key data which in input file.

Can you please provide me sample query.

I know that we can achieve this using Cobol program. but want to run a query.


Tank you
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12378
Topics: 75
Location: San Jose

PostPosted: Tue Aug 15, 2006 1:52 pm    Post subject: Reply with quote

js01,

Check this link

http://www.mvsforums.com/helpboards/viewtopic.php?p=33151#33151

Kolusu
_________________
Kolusu
www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
js01
Beginner


Joined: 13 Oct 2005
Posts: 84
Topics: 32
Location: INDIA

PostPosted: Tue Aug 15, 2006 6:45 pm    Post subject: Reply with quote

Kolusu,

i have gone thru the link
can you please provide me the JCL (full)

thank you
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12378
Topics: 75
Location: San Jose

PostPosted: Tue Aug 15, 2006 7:11 pm    Post subject: Reply with quote

js01,

Here is the sample unload JCL. You need to pass the sysin parms as shown in the other post.

Code:

//STEP0100 EXEC PGM=IKJEFT01                 
//SYSTSPRT DD  SYSOUT=*,DCB=BLKSIZE=121     
//SYSPRINT DD  SYSOUT=*                     
//SYSTSIN  DD  *                             
 DSN SYSTEM(XXXX)                           
 RUN  PROGRAM(DSNTIAUL) -                   
      PLAN(DSNTIAUL)    -                   
      PARMS('SQL')      -                   
      LIB('XXXX.RUNLIB.LOAD')               
//SYSREC00 DD DSN=YOUR UNLOAD FILE,       
//            DISP=(NEW,CATLG,DELETE),       
//            UNIT=SYSDA,                     
//            SPACE=CYL,(X,Y),RLSE)
//SYSPUNCH DD SYSOUT=*
//SYSIN    DD  *
your select statement here;
/*


Hope this helps...

Cheers

Kolusu
_________________
Kolusu
www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
js01
Beginner


Joined: 13 Oct 2005
Posts: 84
Topics: 32
Location: INDIA

PostPosted: Tue Aug 15, 2006 7:14 pm    Post subject: Reply with quote

kolusu,
I used this jcl but i was getting
Code:

 DSNT502I ERROR IN DSNTIAUL SQL INPUT:                                         
           ELECT PROD_REF_I F                                                 
DSNT408I SQLCODE = -199, ERROR:  ILLEGAL USE OF KEYWORD FROM, TOKEN IS <HEXSTRI
0 DSNT502I ERROR IN DSNTIAUL SQL INPUT:                                         
 DSNT408I SQLCODE = -104, ERROR:  ILLEGAL SYMBOL ".". SOME SYMBOLS THAT MIGHT BE
          <GRAPHSTRING>                                                         
 DSNT418I SQLSTATE   = 42601 SQLSTATE RETURN


JCL


Code:

//SYSTSIN DD *                                   
 DSN SYSTEM (DB2T)                               
 RUN PROGRAM (DSNTIAUL) PLAN(DBATIAUL) -         
 PARM('SQL')                                     
 END                                             
/*                                               
//SYSIN DD *                                     
SELECT PROD_REF_I FROM OWNER.PRODUCT_TABLE
/*       


CAN YOU PLEASE ADVISE
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12378
Topics: 75
Location: San Jose

PostPosted: Tue Aug 15, 2006 8:58 pm    Post subject: Reply with quote

Quote:

RUN PROGRAM (DSNTIAUL) PLAN(DBATIAUL) -
PARM('SQL')

js01,

That Plan is DSNTIAUL you coded it as DBATIAUL and you are missing a Loadlib statement also

Kolusu
_________________
Kolusu
www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
CZerfas
Intermediate


Joined: 31 Jan 2003
Posts: 211
Topics: 8

PostPosted: Wed Aug 16, 2006 6:34 am    Post subject: Reply with quote

Also you should NOT use the first character of the SYSIN JCL data for meaningful input. That means: shift your SQL statement one character to the right. As seen in your error message, the module DSNTIAUL receives the keyword "ELECT ..." from your SYSIN stream and has problems to interpret this information.

regards
Christian
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12378
Topics: 75
Location: San Jose

PostPosted: Wed Aug 16, 2006 7:38 am    Post subject: Reply with quote

Quote:

Also you should NOT use the first character of the SYSIN JCL data for meaningful input. That means: shift your SQL statement one character to the right.


CZerfas,

Utilities running with IKJEFT01 CAN have the sysin cards start from pos 1. Utilities like Sort, IDCAMS have the restriction of control cards starting from pos2. DSNTIAUL runs fine even when you are control cards are starting from pos1.


Kolusu
_________________
Kolusu
www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
js01
Beginner


Joined: 13 Oct 2005
Posts: 84
Topics: 32
Location: INDIA

PostPosted: Wed Aug 16, 2006 1:55 pm    Post subject: Reply with quote

Kolusu,
i am sorry ..its typo.

Actually i used same thing that you mentioned ,can you please help me.


JCL is:
Code:

//JOBLIB   DD DISP=SHR,DSN=TDB2.LOADLIB   
//         DD DISP=SHR,DSN=TDB2T.DSNLOAD 
//STEP0100 EXEC PGM=IKJEFT01             
//SYSTSPRT DD  SYSOUT=*,DCB=BLKSIZE=121   
//SYSPRINT DD  SYSOUT=*                   
//SYSTSIN  DD  *                         
 DSN SYSTEM(DB2T)                         
 RUN  PROGRAM(DSNTIAUL) -                 
      PLAN(DSNTIAUL)    -                 
      PARMS('SQL')      -                 
      LIB('TDB2T.RUNLIB.LOAD')           
//SYSREC00 DD SYSOUT=*                   
//SYSPUNCH DD SYSOUT=*                   
//SYSIN    DD  *                         
 SELECT SNAME  FROM S                     
/*                                       



Error msg:


 DSNT502I ERROR IN DSNTIAUL SQL INPUT:                                         
           SELECT SNAME  FROM S                                                 
DSNT400I SQLCODE = 000,  SUCCESSFUL EXECUTION                                   
                                                                               
 DSNT502I ERROR IN DSNTIAUL SQL INPUT:                                         
           SELECT SNAME  FROM S                                                 
DSNT400I SQLCODE = 000,  SUCCESSFUL EXECUTION                                   
                                                                               
 DSNT502I ERROR IN DSNTIAUL SQL INPUT:                                         
           ELECT SNAME  F                                                       
DSNT408I SQLCODE = -199, ERROR:  ILLEGAL USE OF KEYWORD FROM, TOKEN IS <HEXSTRIN
         EXPECTED                                                               
DSNT418I SQLSTATE   = 42601 SQLSTATE RETURN CODE                               
DSNT415I SQLERRP    = DSNHPARS SQL PROCEDURE DETECTING ERROR                   
DSNT416I SQLERRD    = 0  0  0  -1  14  0 SQL DIAGNOSTIC INFORMATION             
DSNT416I SQLERRD    = X'00000000'  X'00000000'  X'00000000'  X'FFFFFFFF'  X'0000
         INFORMATION                                                           
                                                                               
 DSNT502I ERROR IN DSNTIAUL SQL INPUT:           
DSNT408I SQLCODE = -104, ERROR:  ILLEGAL SYMBOL "<END-OF-STATEMENT>". SOME SYMBO
         <HEXSTRING> <CHARSTRING> <GRAPHSTRING>                                 
DSNT418I SQLSTATE   = 42601 SQLSTATE RETURN CODE                               
DSNT415I SQLERRP    = DSNHPARS SQL PROCEDURE DETECTING ERROR                   
DSNT416I SQLERRD    = 0  0  0  -1  4  0 SQL DIAGNOSTIC INFORMATION             
DSNT416I SQLERRD    = X'00000000'  X'00000000'  X'00000000'  X'FFFFFFFF'  X'0000
         INFORMATION
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12378
Topics: 75
Location: San Jose

PostPosted: Wed Aug 16, 2006 1:57 pm    Post subject: Reply with quote

js01,

You need a SEMI-COLON (;) at the end of your SQL statement. Check and see the example I posted

Kolusu
_________________
Kolusu
www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
js01
Beginner


Joined: 13 Oct 2005
Posts: 84
Topics: 32
Location: INDIA

PostPosted: Wed Aug 16, 2006 1:59 pm    Post subject: Reply with quote

Thank you very much kolusu,

it is working fine...
Back to top
View user's profile Send private message
js01
Beginner


Joined: 13 Oct 2005
Posts: 84
Topics: 32
Location: INDIA

PostPosted: Thu Aug 17, 2006 2:37 pm    Post subject: Reply with quote

Hi,

i have another issue here that i am not getting the cloumn that is mentioned in where cluase as below
Code:

SELECT S#,SNAME,STATUS,CITY FROM S   
    WHERE STATUS IN (00,     
         20,
10,
30,
20,
30);


reslut is:

getting only three columns

any one please suggest me.

Note: when i run same query thru spufi getting mentioned column in resluts
Back to top
View user's profile Send private message
coolman
Intermediate


Joined: 03 Jan 2003
Posts: 283
Topics: 27
Location: US

PostPosted: Thu Aug 17, 2006 2:56 pm    Post subject: Reply with quote

You've used SYSREC00 DD SYSOUT=*, instead of SYSOUT=*, try coding a dataset there and you would get the intended results.
________
medical cannabis


Last edited by coolman on Sat Feb 05, 2011 1:48 am; edited 1 time in total
Back to top
View user's profile Send private message
js01
Beginner


Joined: 13 Oct 2005
Posts: 84
Topics: 32
Location: INDIA

PostPosted: Thu Aug 17, 2006 3:17 pm    Post subject: Reply with quote

I tried with dataset set also...didn't get desired resluts...i feel that there is no diffrence...


please help me
Back to top
View user's profile Send private message
shekar123
Advanced


Joined: 22 Jul 2005
Posts: 528
Topics: 90
Location: Bangalore India

PostPosted: Fri Aug 18, 2006 1:59 am    Post subject: Reply with quote

js01,

Why are u using STATUS values to be checked 2 times for values 20 and 30 and you need not need to include 2 times.Try the code where you will get all the displays of the column values.Hope this helps.
Code:

//SYSPRINT DD SYSOUT=*                                                 
//SYSOUT   DD SYSOUT=*                                                 
//SYSUDUMP DD SYSOUT=*                                                 
//SYSREC00 DD SYSOUT=*                                                 
//SYSPUNCH DD SYSOUT=*                                                 
//SYSIN    DD *                                                         
  SELECT S#,SNAME,CHAR(STATUS),CITY FROM S                       
  WHERE STATUS IN (00,                                                 
                   10,                                                 
                   20,                                                 
                   30);                                                 
/*                                                                     

OUTPUT
Code:

---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8-
********************************* TOP OF DATA **********************************
01 SHEKAR     0      BANGALORE                                                 
02 KOLUSU     10     BANGALORE                                                 
03 VIVEK      20     BANGALORE                                                 
04 JS01       30     BANGALORE                                                 
05 FRANK      0      BANGALORE                                                 

You could also use a dataset as output instead of SYSOUT=*
Try this code:
Code:

//SYSPRINT DD SYSOUT=*                                                 
//SYSOUT   DD SYSOUT=*                                                 
//SYSUDUMP DD SYSOUT=*                                                 
//SYSREC00 DD DSN=SHEKAR.DB2.UNLOAD,DISP=(NEW,CATLG,CATLG),             
//            SPACE=(TRK,(1,1),RLSE),UNIT=SYSDA                         
//SYSPUNCH DD SYSOUT=*                                                 
//SYSIN    DD *                                                         
  SELECT S#,SNAME,CHAR(STATUS),CITY FROM S                       
  WHERE STATUS IN (00,                                                 
                   10,                                                 
                   20,                                                 
                   30);                                                 
/*                               

OUTPUT DATASET
Code:

----+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8
********************************* Top of Data **********************************
01.SHEKAR    .0     .BANGALORE .                                               
02.KOLUSU    .10    .BANGALORE .                                               
03.VIVEK     .20    .BANGALORE .                                               
04.JS01      .30    .BANGALORE .                                               
05.FRANK     .0     .BANGALORE .                                               


Check this link for CHAR Scalar Function:

http://publibz.boulder.ibm.com/cgi-bin/bookmgr_OS390/BOOKS/DSNSQH11/3.2.11?SHELF=&DT=20010718164132&CASE=
_________________
Shekar
Grow Technically
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Database All times are GMT - 5 Hours
Goto page 1, 2  Next
Page 1 of 2

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


MVSFORUMS
Powered by phpBB © 2001, 2005 phpBB Group