Home      Mainframe Forum      Mainfarme Tutorials      IBM Manuals      Mainframe Interview Questions      Mainframe Books      IT News     SiteMap     Downloads


     
 
MAINFRAME - TIP OF THE DAY : When you specified V for RECFM parameter, LRECL value is largest record in the file plus 4 bytes. These four bytes contain the actual length of each variable length record in the file

Google
 
Web mainframegurukul.com

how to read and write only first & last records of a fil

 
Post new topic   Reply to topic    mainframegurukul.com Forum Index -> DFSORT , ICETOOL & Utilities
  View previous topic :: View next topic  
Author Message
Subha
Member


Joined: 17 Jun 2011
Posts: 13

Answer was approved by Question owner.
Useful Post
0 votes
Not an useful post
Greate Post!! Salute Author
0 salutes

PostPosted: Mon Jul 11, 2011 12:57 pm    Post subject: how to read and write only first & last records of a fil Reply with quote

Hi,

How to read only first & last records of a file and write first 8 characters of first, last records into output file.

Its urgent, someone pls help. Thanks.

Input:
Code:
20110625  a  CMNSTARTSUBSYS                                           
20110625  m  BAACMHK AHJC019335Staging libraries have been aged       
20110625  mg  BAACMHK AHJC019335Staging libraries have been deleted   
20110625    BAACMHK ECSC000047Package has been aged                 
20110625  a  BAACMHK ECSC000047Package has been deleted               
20110625    BAACMHK ECSC000049Package has been aged                 
20110702  l  S1XSUD1 ESC6000267Activate RWBGBD51.LOD                 
20110702    S1XSUD1 ESC6000267Activate RWBGBD51.PKG                 
20110702    S1XSUD1 ESC6000267Activate RWBGBD51.DBR                 
20110702    S1XSUD1 ESC6000267Activate RWBGBD51.LST                 
20110702    CMNSTARTSUB                                             



Output:
Code:
20110625 20110702


It will be even great, if output comes as below.
Code:
20110625 TO 20110702

or
Code:
20110625 - 20110702


Thanks,
Subha
Back to top
View user's profile Send private message
Click here, If this post answer your question. <-- Click on right mark icon. If this post answer your question.

Frank Yaeger
Moderator


Joined: 18 Feb 2006
Posts: 812
Location: San Jose, CA

Answer was approved by Question owner.
Useful Post
0 votes
Not an useful post
Greate Post!! Salute Author
0 salutes

PostPosted: Mon Jul 11, 2011 9:54 pm    Post subject: Reply with quote

You can use a DFSORT/ICETOOL job like the following to do what you asked for:

Code:

//S1    EXEC  PGM=ICETOOL
//TOOLMSG DD SYSOUT=*
//DFSMSG  DD SYSOUT=*
//IN DD DSN=... input file
//OUT DD DSN=...  output file
//TOOLIN DD *
SUBSET FROM(IN) TO(OUT) INPUT KEEP FIRST LAST USING(CTL1)
/*
//CTL1CNTL DD *
  INREC IFTHEN=(WHEN=GROUP,KEYBEGIN=(1,1),PUSH=(13:1,8,21:SEQ=8))
  OUTFIL INCLUDE=(21,8,ZD,NE,1),
    BUILD=(13,8,C' TO ',1,8,80:X)
/*

_________________
Frank Yaeger - DFSORT Development Team (IBM) - yaeger@us.ibm.com
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
=> DFSORT/MVS is on the Web at http://www.ibm.com/storage/dfsort
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Click here, If this post answer your question. <-- Click on right mark icon. If this post answer your question.
Subha
Member


Joined: 17 Jun 2011
Posts: 13

Answer was approved by Question owner.
Useful Post
0 votes
Not an useful post
Greate Post!! Salute Author
0 salutes

PostPosted: Tue Jul 12, 2011 11:41 am    Post subject: Reply with quote

Thanks Frank. But this did not work for me, Can you pls advise where is it going wrong?

Here is the DFSMSG log.

Code:
ICE200I 0 IDENTIFIER FROM CALLING PROGRAM IS 0001                               
ICE143I 0 BLOCKSET     COPY  TECHNIQUE SELECTED                                 
ICE250I 0 VISIT http://www.ibm.com/storage/dfsort FOR DFSORT PAPERS, EXAMPLES AN
ICE000I 0 - CONTROL STATEMENTS FOR 5694-A01, Z/OS DFSORT V1R10 - 07:58 ON TUE JU
            INREC IFTHEN=(WHEN=GROUP,KEYBEGIN=(1,1),PUSH=(13:1,8,21:SEQ=8))     
                                                                              
ICE006A 0 OPERAND DEFINER ERROR                                                 
            OUTFIL INCLUDE=(21,8,ZD,NE,1),                                     
              BUILD=(13,8,C' TO ',1,8,80:X)                                     
ICE146I 0 END OF STATEMENTS FROM CTL1CNTL - PARAMETER LIST STATEMENTS FOLLOW   
          DEBUG NOABEND,ESTAE                                                   
          OPTION MSGDDN=DFSMSG,LIST,MSGPRT=ALL,RESINV=0,SORTDD=CTL1,SORTIN=IN,SO
                         TOUT=OUT,DYNALLOC,EQUALS,NOCHECK,COPY                 
          OMIT COND=ALL                                                         
          OUTFIL FNAMES=OUT                                                     
ICE751I 0 C5-K51707 C6-K51707 C7-K54603 C8-K51707 E7-K51707                     
ICE052I 3 END OF DFSORT                                                         
Back to top
View user's profile Send private message
Click here, If this post answer your question. <-- Click on right mark icon. If this post answer your question.
Subha
Member


Joined: 17 Jun 2011
Posts: 13

Answer was approved by Question owner.
Useful Post
0 votes
Not an useful post
Greate Post!! Salute Author
0 salutes

PostPosted: Tue Jul 12, 2011 11:49 am    Post subject: Reply with quote

Also, Is it possible to get output as below?

Code:
20110625 TO 20110702  CHGMAN3


Note: CHGMAN3 should start at column 23.
Back to top
View user's profile Send private message
Click here, If this post answer your question. <-- Click on right mark icon. If this post answer your question.
Subha
Member


Joined: 17 Jun 2011
Posts: 13

Answer was approved by Question owner.
Useful Post
0 votes
Not an useful post
Greate Post!! Salute Author
0 salutes

PostPosted: Tue Jul 12, 2011 2:20 pm    Post subject: Reply with quote

Frank,

If the error is because of that I dont have DFSORT R14 PTF UQ95213 (Dec, 2004) to use DFSORT's new IFTHEN function then can you please suggest someother way to get the output?

coz, this is urgent and may not be able to wait for PTF installation. Also, please suggest how to install PTF, I will try to get this done.

Thanks.
Back to top
View user's profile Send private message
Click here, If this post answer your question. <-- Click on right mark icon. If this post answer your question.
Frank Yaeger
Moderator


Joined: 18 Feb 2006
Posts: 812
Location: San Jose, CA

Answer was approved by Question owner.
Useful Post
0 votes
Not an useful post
Greate Post!! Salute Author
0 salutes

PostPosted: Tue Jul 12, 2011 10:23 pm    Post subject: Reply with quote

The only PTF you are missing is the Oct, 2010 PTF, but you need that to use KEYBEGIN. Ask your System Programmer to install z/OS DFSORT V1R10 PTF UK90025.

Here's a DFSORT job that will do what you want without using KEYBEGIN:

Code:

//S1    EXEC  PGM=ICETOOL
//TOOLMSG DD SYSOUT=*
//DFSMSG  DD SYSOUT=*
//IN DD DSN=... input file
//OUT DD DSN=...  output file
//TOOLIN DD *
SUBSET FROM(IN) TO(OUT) INPUT KEEP FIRST LAST USING(CTL1)
/*
//CTL1CNTL DD *
  INREC IFTHEN=(WHEN=INIT,OVERLAY=(21:SEQNUM,8,ZD)),           
    IFTHEN=(WHEN=GROUP,BEGIN=(21,8,ZD,EQ,1),PUSH=(13:1,8))     
  OUTFIL INCLUDE=(21,8,ZD,NE,1),                               
    BUILD=(13,8,C' TO ',1,8,23:C'CHGMAN3',80:X)               
/*

_________________
Frank Yaeger - DFSORT Development Team (IBM) - yaeger@us.ibm.com
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
=> DFSORT/MVS is on the Web at http://www.ibm.com/storage/dfsort
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Click here, If this post answer your question. <-- Click on right mark icon. If this post answer your question.
Subha
Member


Joined: 17 Jun 2011
Posts: 13

Answer was approved by Question owner.
Useful Post
0 votes
Not an useful post
Greate Post!! Salute Author
0 salutes

PostPosted: Thu Jul 14, 2011 11:24 am    Post subject: Reply with quote

i got below error. Please suggest what could be the problem.

Code:
ICE200I 0 IDENTIFIER FROM CALLING PROGRAM IS 0001                               
ICE143I 0 BLOCKSET     COPY  TECHNIQUE SELECTED                                 
ICE250I 0 VISIT http://www.ibm.com/storage/dfsort FOR DFSORT PAPERS, EXAMPLES AN
ICE000I 0 - CONTROL STATEMENTS FOR 5694-A01, Z/OS DFSORT V1R10 - 07:48 ON THU JU
            INREC IFTHEN=(WHEN=INIT,OVERLAY=(21:SEQNUM,8,ZD)),                 
              IFTHEN=(WHEN=GROUP,BEGIN=(21,8,ZD,EQ,1),PUSH=(13:1,8))           
            OUTFIL INCLUDE=(21,8,ZD,NE,1),                                     
              BUILD=(13,8,C' TO ',1,8,23:C'CHGMAN3',80:X)                       
ICE146I 0 END OF STATEMENTS FROM CTL1CNTL - PARAMETER LIST STATEMENTS FOLLOW   
          DEBUG NOABEND,ESTAE                                                   
          OPTION MSGDDN=DFSMSG,LIST,MSGPRT=ALL,RESINV=0,SORTDD=CTL1,SORTIN=IN,SO
                         TOUT=OUT,DYNALLOC,EQUALS,NOCHECK,COPY                 
          OMIT COND=ALL                                                         
          OUTFIL FNAMES=OUT                                                     
ICE201I G RECORD TYPE IS V - DATA STARTS IN POSITION 5                         
ICE251A 9 MISSING RDW OR DATA FOR OUT     : REASON CODE 03, IFTHEN 0           
ICE751I 0 C5-K51707 C6-K51707 C7-K54603 C8-K51707 E9-K51707 E7-K51707           
ICE052I 3 END OF DFSORT                                                         


I think the error is something to do with record format.

Attributes of input file:

Code:
Management class . . : X000N395
Storage class  . . . : SCTMM   
  Volume serial . . . : EWRK73 +
  Device type . . . . : 3390     
Data class . . . . . : DCTMM   
  Organization  . . . : PS       
  Record format . . . : VB       
 Record length . . . : 5000     
 Block size  . . . . : 27998   
  1st extent megabytes: 1       
 Secondary megabytes : 50       
 Data set name type  :         
 SMS Compressible. . : NO       


Attributes of output file:

Code:
Management class . . : X999N002
Storage class  . . . : SCTSO   
 Volume serial . . . : ETSO03 
 Device type . . . . : 3390   
Data class . . . . . : DCNORMAL
 Organization  . . . : PS     
 Record format . . . : FB     
 Record length . . . : 163     
  Block size  . . . . : 16300   
 1st extent tracks . : 45     
 Secondary tracks  . : 30     
 Data set name type  :         
 SMS Compressible. . : NO     


[/b][/u]
Back to top
View user's profile Send private message
Click here, If this post answer your question. <-- Click on right mark icon. If this post answer your question.
Frank Yaeger
Moderator


Joined: 18 Feb 2006
Posts: 812
Location: San Jose, CA

Answer was approved by Question owner.
Useful Post
0 votes
Not an useful post
Greate Post!! Salute Author
0 salutes

PostPosted: Thu Jul 14, 2011 9:45 pm    Post subject: Reply with quote

You should have mentioned the input and output attributes earlier. It makes a difference.

Here's a DFSORT job for those attributes:

Code:

//S2    EXEC  PGM=ICETOOL
//TOOLMSG DD SYSOUT=*
//DFSMSG  DD SYSOUT=*
//IN DD DSN=...  input file (VB/5000)
//OUT DD DSN=...  output file (FB/163)
//TOOLIN DD *
SUBSET FROM(IN) TO(OUT) INPUT KEEP FIRST LAST USING(CTL1)
//CTL1CNTL DD *
  INREC IFTHEN=(WHEN=INIT,BUILD=(1,12,21:SEQNUM,8,ZD)),
      IFTHEN=(WHEN=GROUP,BEGIN=(21,8,ZD,EQ,1),PUSH=(13:5,8))
  OUTFIL INCLUDE=(21,8,ZD,NE,1),VTOF,
    BUILD=(13,8,C' TO ',5,8,C'  CHGMAN3',163:X)
/*

_________________
Frank Yaeger - DFSORT Development Team (IBM) - yaeger@us.ibm.com
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
=> DFSORT/MVS is on the Web at http://www.ibm.com/storage/dfsort
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Click here, If this post answer your question. <-- Click on right mark icon. If this post answer your question.
Subha
Member


Joined: 17 Jun 2011
Posts: 13

Answer was approved by Question owner.
Useful Post
0 votes
Not an useful post
Greate Post!! Salute Author
0 salutes

PostPosted: Fri Jul 15, 2011 5:15 pm    Post subject: Reply with quote

I did not observe the difference in the attributes.

Anyway, thanks a lot for all your help. You are genious, I must say.

Thanks again.
Back to top
View user's profile Send private message
Click here, If this post answer your question. <-- Click on right mark icon. If this post answer your question.
academyindia4
Guest





Answer was approved by Question owner.
Useful Post
0 votes
Not an useful post
Greate Post!! Salute Author
0 salutes

PostPosted: Mon Jan 25, 2016 10:00 pm    Post subject: Topic deleted by Admin Reply with quote

<< Content deleted By Admin >>
Back to top
Click here, If this post answer your question. <-- Click on right mark icon. If this post answer your question.
Display posts from previous:   
Post new topic   Reply to topic    mainframegurukul.com Forum Index -> DFSORT , ICETOOL & Utilities All times are GMT + 5 Hours
Page 1 of 1



 
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


Cobol Tutorial
This cobol tutorial covers most of the important topics like STRING, UNSTRING, COMP, COMP-3.....
DB2 Tutorial
DB2 Tutorial focuses on DB2 COBOL Programming. Explains in simple language. Some Chapters are locked, Forum members have free access to these chapters
CICS Tutorial
This CICS tutorial covers CICS concepts and CICS Basics, CICS COBOL Programming...
JCL Tutorial
This is most popular JCL tutorial from mainframegurukul. It does contain important jcl ....
SORT Tutorial
This Tutorial covers all important aspects of DFSORT. Has more SORT examples
INTERVIEW Questions
This page covers important interview questions
Mainframe Jobs
Mainframe Jobs posted by members of mainframegurukul forum
FaceBook Page
MainframeGurukul FaceBook Page
LinkedIn Page
MainframeGurkul Linkedin Page

This widget requires Flash Player 9 or better







Go to top of the page
 

Online ABEND Reference ||  JCL References ||  COBOL References ||  VSAM References ||  Tutorials by Drona Series ||  SQL tutorial ||  BOOKS  ||  DB2 INTERVIEW QUESTIONS ||  COBOL INTERVIEW QUESTIONS  ||  JCL INTERVIEW QUESTIONS ||  JCL2 INTERVIEW QUESTIONS ||  VSAM INTERVIEW QUESTIONS ||  CICS INTERVIEW QUESTIONS  ||  Online tutorials ||  Online ABEND Reference ||  JCL References ||  COBOL References ||  VSAM References ||  Tutorials by Drona Series ||  SQL tutorial ||  BOOKS  ||  SiteMap  ||  Expeditor Tutorial  ||  FILE-AID Tutorial  ||  Changeman Tutorial  ||  COBOL   ||  DB2   ||  JCL  ||  CICS  ||  VSAM  ||  DB2 Interview Questions ( 110 )   || Simple JCL Tutorials  || JCL Tutorial from MainframeGurukul.com   || Simple JCL Tutorial - Chapter1 ;|| Mainframe Forum - Tutorials  || Mainframe Tutorials || Mainframe CICS tutorial|| Mainframe COBOL Tutorial

Drona Educational Forums - Mainframe Cobol DB2 CICS Board
Powered by phpBB

mainframetopic-5871.html