IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

Comparing file record with JCL variable through JCL ?


IBM Mainframe Forums -> JCL & VSAM
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
Abhinav Chandra

New User


Joined: 13 Oct 2012
Posts: 29
Location: India

PostPosted: Wed Sep 11, 2013 12:01 am
Reply with quote

HI,

I need to compare a record present in the file with the JCL variable though JCL. Can anyone suggest me suitable approach to do so through JCL.

Cheers !! icon_biggrin.gif
Back to top
View user's profile Send private message
superk

Global Moderator


Joined: 26 Apr 2004
Posts: 4652
Location: Raleigh, NC, USA

PostPosted: Wed Sep 11, 2013 1:23 am
Reply with quote

I'm not sure I understand this requirement. Could you provide some more details and/or examples, and also maybe some idea of what program(s) you might be using or might want to use to accomplish this?
Back to top
View user's profile Send private message
Abhinav Chandra

New User


Joined: 13 Oct 2012
Posts: 29
Location: India

PostPosted: Wed Sep 11, 2013 1:42 am
Reply with quote

I need to compare the data present in PS file with the data present in the JCL variable.
Suppose the data in the PS file is 1234 and we have also declared a JCL variable as
// SET VAR1=1212.

Thus now I need to compare the data present in PS file and in JCL variable(VAR1) through JCL i.e. comparing 1234 with 1212.

Did you get it now !!
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Wed Sep 11, 2013 1:49 am
Reply with quote

Hello,

As superk mentioned, your request is rather unclear.

When you mention JCL 3 times, i suspect you mean you want to create some JCL that will execute "something" (not JCL - for example the sort) that will read a file and create/modify some JCL.

Please post what you "have" and what you want to do with it.
Back to top
View user's profile Send private message
superk

Global Moderator


Joined: 26 Apr 2004
Posts: 4652
Location: Raleigh, NC, USA

PostPosted: Wed Sep 11, 2013 1:53 am
Reply with quote

Ok, so you're going to pass the variable VAR1 to a program so it can be resolved by the Internal Reader during the input phase, i.e.:

//STEPX EXEC PGM=somepgm,PARM='&VAR1'

so in the jobstep STEPX you'll have the program "somepgm" receiving a value of '1212' as per your example. Then what?
Back to top
View user's profile Send private message
Abhinav Chandra

New User


Joined: 13 Oct 2012
Posts: 29
Location: India

PostPosted: Wed Sep 11, 2013 2:07 am
Reply with quote

HI Dick / Superk,

Yes you are correct, I need to create jcl for this.

I am having -
1. A ps file having one record = 1234
2. JCL variable referred in the same JCL itself by =
// SET VAR1=1212

I need a approach by only using JCL to compare the data present in these two (that is data in file and in variable).

Proposed work around -
1. Will be also helpful if we can copy the record from the PS file to another JCL variable and then it will be easy to compare two variables through IF - ELSE in JCL.

OR

2. Will be also helpful if we can copy the JCL variable to a PS file and then it will be easy to compare two files through IEBCOMPR utility.

Hope its clear now.
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Wed Sep 11, 2013 2:43 am
Reply with quote

Hello,

Quote:
then it will be easy to compare two variables through IF - ELSE in JCL.
I don't believe this will do what you want. Suggest you run an experiment of simplying trying to do the compare "in JCL".

When you create a process (if you proceed this way), you will need a "front-ende" process to read the file and generate the "real JCL". Then submit the newly created/modified JCL thru the internal reader.

If you post the pieces you already have, someone may be able to make a suggestion you can use. Also, make sure there is no rule against generating Production JCL "on the fly" on your system.
Back to top
View user's profile Send private message
Abhinav Chandra

New User


Joined: 13 Oct 2012
Posts: 29
Location: India

PostPosted: Wed Sep 11, 2013 12:16 pm
Reply with quote

I think you still didn't get the requirement -

This piece of code works fine.
//*
// SET CDATE=0831
//*
//COMPR1 EXEC PGM=IEBCOMPR
//SYSUT1 DD DSN=Z002412.ABHI.TEST.SQLNW,DISP=OLD
//SYSUT2 DD *
0830
//SYSOUT DD SYSOUT=*
//SYSPRINT DD SYSOUT=*
//SYSIN DD *

I am trying to do same with -
//*
// SET CDATE=$CQMCDATE
//*
//COMPR1 EXEC PGM=IEBCOMPR
//SYSUT1 DD DSN=Z002412.ABHI.TEST.SQLNW,DISP=OLD
//SYSUT2 DD *
&CDATE
//SYSOUT DD SYSOUT=*
//SYSPRINT DD SYSOUT=*
//SYSIN DD *

I know it wont pick the correct date in sysut2. Thus looking for any other alternative to accomplish this requirement.

Please let me know for any concern in the understanding.
Back to top
View user's profile Send private message
Garry Carroll

Senior Member


Joined: 08 May 2006
Posts: 1193
Location: Dublin, Ireland

PostPosted: Wed Sep 11, 2013 12:40 pm
Reply with quote

You could try using your SORT product to take the symbol in a first step to generate the record for the SYSUT2 used in IEBCOMPR in a seconf step.

Garry.
Back to top
View user's profile Send private message
Nic Clouston

Global Moderator


Joined: 10 May 2007
Posts: 2455
Location: Hampshire, UK

PostPosted: Wed Sep 11, 2013 4:56 pm
Reply with quote

SET is used to provide values to JCL variables NOT to data. as everyone says, you can write a program (or use DFSORT) to read the PARM set nby SET and generate what you need. JCL is NOT a programming language - it only tells the system what programs you want to run, the sequence, any conditional execution and the resources required by the programs.
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> JCL & VSAM

 


Similar Topics
Topic Forum Replies
No new posts FTP VB File from Mainframe retaining ... JCL & VSAM 4
No new posts Extract the file name from another fi... DFSORT/ICETOOL 6
No new posts How to split large record length file... DFSORT/ICETOOL 10
No new posts Extracting Variable decimal numbers f... DFSORT/ICETOOL 17
No new posts SFTP Issue - destination file record ... All Other Mainframe Topics 2
Search our Forums:

Back to Top