Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

how to write parm values in output file.

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
View previous topic :: :: View next topic  
Author Message
Gopalakrishnan V

Active User


Joined: 28 Jun 2010
Posts: 102
Location: chennai

PostPosted: Thu Nov 20, 2014 6:56 pm    Post subject: how to write parm values in output file.
Reply with quote

Hi,

I have a JCL with PARM value as &DATE. we are passing the date dynamically while running the job.

My JCL will look like as below,
Code:

//STEP01  EXEC PGM=ICETOOL,                                     
//   PARM='&DATE'                                             
//INFILE  DD DSN=INFILE.R&DATE,DISP=SHR
//OUTFILE DD DSN=OUTFILE.R&DATE,         
//            DISP=(NEW,CATLG,DELETE),UNIT=DELS,               
//            SPACE=(CYL,(1,1),RLSE),                           
//            DCB=(BLKSIZE=0,RECFM=FB,BUFNO=20)                 
//SYSOUT DD SYSOUT=*                                           
//TOOLMSG   DD SYSOUT=*                                         
//DFSMSG   DD SYSOUT=*                                           
//TOOLIN DD *                                                   
   OCCUR FROM(INFILE) LIST(OUTFILE) -                           
       NOHEADER NOCC-                                           
       ON(1,03,CH) -                                         
       ON(VALCNT,N04)
/*
//CTL2CNTL DD *                   
       OUTREC FIELDS=(7:&DATE)
/*                               


I/p file:
IND
AUS
AUS
IND
USA

PARM=2141120 (YYYMMDD)

Expected output file:
IND 2 2141120
AUS 2 2141120
USA 1 2141120

But I am not getting the date field as below ,

IND 2
AUS 2
USA 1

o/p LAYOUT:

COUNTRY COUNT DATE

I dont know whether it can be achievable in JCL itself without using DFSORT/ICETOOL. Thats what I have posted under JCL Topic. Please suggest some solution for this problem.

Thanks in advance
Back to top
View user's profile Send private message

Bill Woodger

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7223

PostPosted: Thu Nov 20, 2014 7:11 pm    Post subject: Reply to: how to write parm values in output file.
Reply with quote

Which SORT product do you have? (look at the message prefix in the output from your step).

By what magic did you believe specifying CTL2CNTL would cause that file to be processed?

You would need a USING on your OCCUR/OCCURS operator to do that, except you can't have that anyway.

To get a PARM into SORT control cards, you can't do it that way, so you'd have to do it the correct way.

&DATE is a SORT function anyway.

Also see this.

Your BUILD (FIELDS) would create an output record with six blanks followed by the &DATE, which also isn't what you want.

In short, there are many ways this won't work, so you'll have to do some re-thinking.
Back to top
View user's profile Send private message
Gopalakrishnan V

Active User


Joined: 28 Jun 2010
Posts: 102
Location: chennai

PostPosted: Thu Nov 20, 2014 9:08 pm    Post subject: Reply to: how to write parm values in output file.
Reply with quote

Thank you Bill for your reply.

I am not worrying about the spaces in output file...I need the PARM values in output file along with count logic. Because I will change this JCL with JOB and PROC format. So I will pass the parm in JOB jcl manually while submitting the job. Also I will change the &DATE variable into &RUNDATE since this keyword already used in JCL.

I have read the below post but that is for UNIX with JPn logic with DFSORT. similar kind of requirement.

[url]
http://stackoverflow.com/questions/21481400/passing-symbol-value-using-dfsort-to-file
[/url]

could you please modify it for DFSORT/JCL. It will be grateful if you share some code snippet to fulfill my requirement.
Back to top
View user's profile Send private message
Bill Woodger

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7223

PostPosted: Thu Nov 20, 2014 9:24 pm    Post subject: Reply to: how to write parm values in output file.
Reply with quote

The link is indeed for DFSORT, but DFSORT doesn't run on Unix, so it is not for Unix.

The link shows you exactly how to get a PARM value from a JCL Symbol into DFSORT, as do examples here.

I'm not sure how well you read my previous post. You're going to have to forget OCCUR/OCCURS.

Can you show some representative sample input and expected output?
Back to top
View user's profile Send private message
Gopalakrishnan V

Active User


Joined: 28 Jun 2010
Posts: 102
Location: chennai

PostPosted: Thu Nov 20, 2014 9:33 pm    Post subject: Reply to: how to write parm values in output file.
Reply with quote

PARM=2141120 (YYYMMDD)

Input file:

IND
AUS
AUS
IND
USA

Expected output file:
IND 2 2141120
AUS 2 2141120
USA 1 2141120

Country code along with their count and date passed in PARM.
Example: IND occurred two times.

Please let me know if you need more information.
Back to top
View user's profile Send private message
superk

Moderator Team Head


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

PostPosted: Fri Nov 21, 2014 3:57 am    Post subject: Reply to: how to write parm values in output file.
Reply with quote

I'm thinking it would look something like this:

Code:

// EXPORT SYMLIST=(DATE)                                         
// SET DATE='2141120'                                             
//*                                                               
//SORT     EXEC PGM=ICETOOL                                     
//SYMNAMES DD   *,SYMBOLS=JCLONLY                                 
DAT,C'&DATE'                                                     
/*                                                               
//INFILE   DD   *                                                 
IND                                                               
AUS                                                               
AUS                                                               
IND                                                               
USA                                                               
/*                                                               
//T1       DD   DSN=&&T1,DISP=(,PASS),UNIT=VIO                   
//OUTFILE  DD   SYSOUT=*                                         
//TOOLMSG  DD   SYSOUT=*                                         
//DFSMSG   DD   SYSOUT=*                                         
//TOOLIN   DD   *                                                 
  COPY FROM(INFILE) TO(T1) USING(CTL1)                 
  OCCUR FROM(T1) LIST(OUTFILE) -                       
    NOHEADER NOCC -                                   
    ON(1,3,CH) ON(VALCNT,N02) ON(5,8,CH)               
/*                                                     
//CTL1CNTL DD   *                                     
  OUTFIL BUILD=(1,3,X,DAT,80:X)                       
/*                                                     
//*                                                   
Back to top
View user's profile Send private message
Gopalakrishnan V

Active User


Joined: 28 Jun 2010
Posts: 102
Location: chennai

PostPosted: Fri Nov 21, 2014 5:23 pm    Post subject: Reply to: how to write parm values in output file.
Reply with quote

Thank you Bill & Kevin icon_smile.gif
The code which Kevin suggested is working fine and concept behind build statement explained by Bill was very useful.
Back to top
View user's profile Send private message
Bill Woodger

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7223

PostPosted: Fri Nov 21, 2014 6:43 pm    Post subject: Reply to: how to write parm values in output file.
Reply with quote

Both on an up-to-date z/OS, and doing the symbol substitution on instream data :-)

You are reading the file twice. The file is SORTed in the OCCUR/OCCURS. You have shown your sample input as unsorted, so that is OK, but you showed your expected output in the same order as the original file (IND came first). You will not be getting your output like that.

Your number of digits for the count suggest small files, so reading the file twice won't show up too much, perhaps. What about the output order?
Back to top
View user's profile Send private message
Gopalakrishnan V

Active User


Joined: 28 Jun 2010
Posts: 102
Location: chennai

PostPosted: Mon Nov 24, 2014 12:36 pm    Post subject: Reply to: how to write parm values in output file.
Reply with quote

Hi Bill,

Sorry I gave the sample output without sorting. I have my input in sorted order.So I hope the output also will be sorted. But the output column needs to be in the below order,

COUNTRY-NAME COUNT PARM-DATE
Back to top
View user's profile Send private message
Bill Woodger

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7223

PostPosted: Mon Nov 24, 2014 1:29 pm    Post subject: Reply to: how to write parm values in output file.
Reply with quote

If the output order is the same as the input order, you don't need to SORT.

Have a look at using plain SORT (not ICETOOL) with reporting features REMOVECC and SECTIONS with TRAILER2.

If you're sticking with the instream symbol replacement I hope they toss it out when you try to go to Production. Use the JPn for PARM values in SORT.
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Add PD field from 2nd file to PD in 1st Sushant Garje DFSORT/ICETOOL 6 Thu Dec 01, 2016 4:32 pm
No new posts File Aid to File Manager conversion murali3955 IBM Tools 4 Thu Nov 24, 2016 3:41 pm
No new posts How to convert the VBM file to VB or... Sulabh Agrawal JCL & VSAM 4 Fri Nov 18, 2016 1:04 pm
No new posts CICS Roll back partially - Need to re... dwijadas CICS 4 Wed Nov 16, 2016 4:30 pm
No new posts Problem in writing Output file vickey_dw COBOL Programming 5 Mon Nov 14, 2016 11:14 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us