Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Profile Log in to check your private messages Log in
 
How update a record counter of an an existing header.

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

New User


Joined: 25 Jan 2007
Posts: 32
Location: france

PostPosted: Wed Oct 05, 2011 7:16 pm    Post subject: How update a record counter of an an existing header.
Reply with quote

Hello,

I have an input file (LRECL=FB, RECFM=FB) that contains 101 records. The first is a header that contains a record counter in position 15 for a length of 7.

Code:
----+----1----+----2----+----3----+----4----+----5
********************************* Top of Data ****
.20111004XXXXX0000008
3XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
3XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
3XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
3XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX


I need to create a new file that contains (from the input file)
    The header file with the record counter updated
    The records that contains cā€™3ā€™ in first position


The result I need:

Code:
----+----1----+----2----+----3----+----4----+----5
********************************* Top of Data ****
.20111004XXXXX0000004
3XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
3XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
3XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
3XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX


To select the records I use an INCLUDE COND :

Code:
//S10      EXEC PGM=ICETOOL
//TOOLMSG  DD SYSOUT=*
//DFSMSG   DD SYSOUT=*
//SHOWDEF  DD SYSOUT=*
//SORTDIAG DD SYSOUT=*
//*
//IN       DD DISP=SHR,DSN=&SOURCE
//OUT      DD DISP=(NEW,CATLG,DELETE),
//            DSN=&TARGET,
//            LIKE=&SOURCE
//TOOLIN   DD *
  COPY FROM(IN) TO(OUT) USING(CTL1)
/*
//CTL1CNTL DD *
  INCLUDE COND=(1,1,CH,EQ,Cā€™3ā€™)
/*


I need help for the header processing.

Could anyone of you suggest.
Regards,
tuxama
Back to top
View user's profile Send private message

Escapa

Senior Member


Joined: 16 Feb 2007
Posts: 1399
Location: IL, USA

PostPosted: Wed Oct 05, 2011 7:39 pm    Post subject: Reply to: How update a record counter of an an existing head
Reply with quote

Hi,
Below sort steps will give you desired.
Code:

//STEP0100 EXEC PGM=SORT                           
//SYSOUT   DD SYSOUT=*                             
//SORTIN   DD *                                     
.20111004XXXXX0000008                               
3XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX       
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX       
3XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX       
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX       
3XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX       
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX       
3XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX       
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX       
//SORTOUT  DD DSN=&&TEMP,DISP=(NEW,PASS)           
//SYSIN    DD *                                     
 INCLUDE COND=(1,1,CH,EQ,C'3',OR,1,1,CH,EQ,C'.')   
 SORT FIELDS=(1,1,CH,D)                             
 OUTFIL IFTRAIL=(TRLID=(1,1,CH,EQ,C'.'),           
 TRLUPD=(15:COUNT=(M11,LENGTH=7)))                 
/*                                                 
//STEP0200 EXEC PGM=SORT                           
//SYSOUT   DD SYSOUT=*                             
//SORTIN   DD DSN=&&TEMP,DISP=(MOD,PASS)     
//SORTOUT  DD SYSOUT=*                       
//SYSIN    DD *                             
 SORT FIELDS=(1,1,CH,A)                     
/*                                           


Output will be:
Code:

.20111004XXXXX0000004                         
3XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX 
3XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX 
3XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX 
3XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX 

Note: I have not bothered about sequence of detail level records.
Let us know if you want to preserve sequence in detail line
Back to top
View user's profile Send private message
Skolusu

Senior Member


Joined: 07 Dec 2007
Posts: 2205
Location: San Jose

PostPosted: Wed Oct 05, 2011 10:12 pm    Post subject: Reply to: How update a record counter of an an existing head
Reply with quote

tuxama,

Use the following DFSORT/JCL which will give you the desired results. The trick here is to use the same file as input to joinkeys. I assumed that your input has an lrecl=80 and recfm=fb


Code:

//STEP0100 EXEC PGM=SORT                           
//SYSOUT   DD SYSOUT=*                             
//INA      DD *                                     
----+----1----+----2----+----3----+----4----+----5--
.20111004XXXXX0000008                               
3XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX       
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX       
3XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX       
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX       
3XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX       
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX       
3XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX       
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX       
//INB      DD *                                     
.20111004XXXXX0000008                               
3XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX       
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX       
3XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX       
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX       
3XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX       
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX       
3XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX       
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX       
//SORTOUT  DD SYSOUT=*                             
//SYSIN    DD *                                   
  OPTION COPY                                     
  JOINKEYS F1=INA,FIELDS=(81,7,A),SORTED,NOSEQCK   
  JOINKEYS F2=INB,FIELDS=(01,7,A)                 
  JOIN UNPAIRED                                   
  REFORMAT FIELDS=(F1:1,80,?,F2:8,7)               
  INREC IFOUTLEN=80,                               
  IFTHEN=(WHEN=(81,1,CH,EQ,C'B'),OVERLAY=(15:82,7))
//*                                               
//JNF1CNTL DD *                                   
  INCLUDE COND=(1,1,SS,EQ,C'.,3')                 
  INREC OVERLAY=(81:SEQNUM,7,ZD)                   
//*                                               
//JNF2CNTL DD *                                   
  INCLUDE COND=(1,1,CH,EQ,C'3')                   
  INREC BUILD=(2C'0000001')                       
  SUM FIELDS=(8,7,ZD)                             
//*


Escapa, it would be efficient if you generated a symbol with the count in the first step and then use that to overlay the count in second step.
Back to top
View user's profile Send private message
tuxama

New User


Joined: 25 Jan 2007
Posts: 32
Location: france

PostPosted: Thu Oct 06, 2011 11:46 am    Post subject: Reply to: How update a record counter of an an existing head
Reply with quote

Thank you for your answers, now the problem is solved.


Escapa
In that case the sequence does not matter.
But it is a really good remark. According to you, what is the best way of preserving the original sequence ?
Back to top
View user's profile Send private message
Bill Woodger

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7315

PostPosted: Thu Oct 06, 2011 12:04 pm    Post subject: Reply to: How update a record counter of an an existing head
Reply with quote

To keep the original order of records when SORT keys are equal, look up EQUALS in the manual.
Back to top
View user's profile Send private message
Escapa

Senior Member


Joined: 16 Feb 2007
Posts: 1399
Location: IL, USA

PostPosted: Thu Oct 06, 2011 3:56 pm    Post subject:
Reply with quote

Hi Tuxama,
These is one more approach using Symbol
Code:

//STEP0100 EXEC PGM=SORT                                   
//SYSOUT   DD SYSOUT=*                                     
//SORTIN   DD dsn=your input here                   
//SORTOUT  DD DSN=&&TEMP,DISP=(NEW,PASS),RECFM=FB,LRECL=80 
//SYSIN    DD *                                             
 OPTION COPY                                               
 INCLUDE COND=(1,1,CH,EQ,C'3',OR,1,1,CH,EQ,C'.')           
 OUTFIL NODETAIL,REMOVECC,                                 
 TRAILER1=(C'RECCNT,C''',COUNT-1=(M11,LENGTH=7),           
 C'''',80:X)                                                 
/*                                                           
//STEP0200 EXEC PGM=SORT                                     
//SYSOUT   DD SYSOUT=*                                       
//SYMNAMES DD DSN=&&TEMP,DISP=(MOD,PASS),LRECL=80,RECFM=FB   
//SORTIN   DD dsn=your input here                                               
//SORTOUT  DD SYSOUT=*                                       
//SYSIN    DD *                                               
 OPTION COPY                                                 
 INCLUDE COND=(1,1,CH,EQ,C'3',OR,1,1,CH,EQ,C'.')             
 OUTREC IFTHEN=(WHEN=(1,1,CH,EQ,C'.'),OVERLAY=(15:RECCNT))   
Back to top
View user's profile Send private message
tuxama

New User


Joined: 25 Jan 2007
Posts: 32
Location: france

PostPosted: Thu Oct 06, 2011 5:00 pm    Post subject: Reply to: How update a record counter of an an existing head
Reply with quote

Thank you for your solutions and your time.
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 Updating the Trailer count in variabl... satheshbabur DFSORT/ICETOOL 6 Wed Aug 30, 2017 9:49 pm
No new posts Repeat part of record multiple times Learncoholic DFSORT/ICETOOL 4 Tue Aug 29, 2017 11:33 am
No new posts Read two inputs and write into output... murali.andaluri DFSORT/ICETOOL 6 Wed Jul 26, 2017 7:35 pm
No new posts How to add header with Date(YYMMDD) i... Rajan Moorthy DFSORT/ICETOOL 2 Thu Jul 06, 2017 11:44 pm
No new posts Need to write record of PS File in ex... Chandan1993 JCL & VSAM 1 Wed Jun 07, 2017 1:35 am

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us