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 update trailer count

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> JCL & VSAM
View previous topic :: :: View next topic  
Author Message
sandip_mainframe
Warnings : 2

New User


Joined: 20 Sep 2006
Posts: 61
Location: pune

PostPosted: Wed Mar 20, 2013 4:11 pm    Post subject: How to update trailer count
Reply with quote

Hi All,

I have below records in my input file

10 - Header record
20 - Detail record
90 - Trailer record

Input file Details -
RECFM=FB,LRECL=1300,BLKSIZE=27300


Input file data -

1000220130320
20 21400 PUNE
20 21500 MUMBAI
20 21600 PUNE
90
1000120130320
20 21700 PUNE
20 21800 MUMBAI
20 21900 PUNE
20 22000 PUNE
20 23000 PUNE
20 24000 PUNE
90

Here I want count total total number of detail records, and want to write in trailer record from 3rd position as below -

Required file output data -

1000220130320
20 21400 PUNE
20 21500 MUMBAI
20 21600 PUNE
90000000003
1000120130320
20 21700 PUNE
20 21800 MUMBAI
20 21900 PUNE
20 22000 PUNE
20 23000 PUNE
20 24000 PUNE
90000000006


I am trying below condition but it is not giving expected results -

SORT FIELDS=COPY
OUTREC IFOUTLEN=1300,
IFTHEN=(WHEN=INIT,OVERLAY=(1301:SEQNUM,9,ZD,START=0)),
IFTHEN=(WHEN=(1,1,ZD,EQ,9),OVERLAY=(3:1301,9))

Above SORT is giving as below result, but is is not expected -

1000220130320
20 21400 PUNE
20 21500 MUMBAI
20 21600 PUNE
90000000005
1000120130320
20 21700 PUNE
20 21800 MUMBAI
20 21900 PUNE
20 22000 PUNE
20 23000 PUNE
20 24000 PUNE
90000000012


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

Bill Woodger

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7233

PostPosted: Wed Mar 20, 2013 4:19 pm    Post subject: Reply to: How to update trailer count
Reply with quote

Try with IFTHEN=(WHEN=GROUP, with the 10 marking the start of the group and the 90 the end. PUSH a SEQ after the "end" of your fixed records.

Then IFTHEN=(WHEN=(logexp to identify the "trailer" and OVERLAY the count, modified appropriately, from the extension to where you want it on the trailer.

You can use IFOUTLEN=1300 to ensure that the extension is not actually written. IFOUTLEN is not a condition, it means "set the output length to <value> after all the IFTHENs are completed.
Back to top
View user's profile Send private message
sandip_mainframe
Warnings : 2

New User


Joined: 20 Sep 2006
Posts: 61
Location: pune

PostPosted: Wed Mar 20, 2013 4:35 pm    Post subject: Reply to: How to update trailer count
Reply with quote

Hi Bill,

Thanks for your help, Could you please explain 1st line, I got meaning of 2nd line but, about first line I am not clear, I am not aware
how to make a group.
Back to top
View user's profile Send private message
Bill Woodger

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7233

PostPosted: Wed Mar 20, 2013 6:25 pm    Post subject: Reply to: How to update trailer count
Reply with quote

There are examples in the DFSORT manuals, and many here.

Code:
10
20
20
20
20
90
10
20
20
90
10
90


You have "groups" of records, with 10 defining the "start" and 90 defining the "end". PUSH, which is used with WHEN=GROUP, can be used to "overlay" a sequence within the group. When you later identify the 90 record, the sequence on that record includes the count for 10, any/all 20s and 90. So you can put a count onto the 90, using OVERLAY to where you want, and in the form that you want, from where you PUSHED the sequence number and subtracting 2.
Back to top
View user's profile Send private message
sandip_mainframe
Warnings : 2

New User


Joined: 20 Sep 2006
Posts: 61
Location: pune

PostPosted: Thu Mar 21, 2013 5:41 pm    Post subject: Reply to: How to update trailer count
Reply with quote

Hi Bill,

I am using below sort card but getting error -

Code:
//SYSIN     DD  *                                     
  SORT FIELDS=COPY                                   
  OUTREC IFOUTLEN=1300,                               
  IFTHEN=(WHEN=GROUP,BEGIN=(1,1,CH,EQ,C'2'),         
                             END=(1,1,CH,EQ,C'9'),   
                             PUSH=(3:1301,9)),       
  IFTHEN=(WHEN=(1,1,ZD,EQ,9),OVERLAY=(3:1301,9))     
/*                                                   


I am getting below error

Code:
SYSIN :                                                             
  SORT FIELDS=COPY                                                   
  OUTREC IFOUTLEN=1300,                                             
  IFTHEN=(WHEN=GROUP,BEGIN=(1,1,CH,EQ,C'2'),                         
                             END=(1,1,CH,EQ,C'9'),                   
                             PUSH=(3:1301,9)),                       
  IFTHEN=(WHEN=(1,1,ZD,EQ,9),OVERLAY=(3:1301,9))                     
WER276B  SYSDIAG= 3067073, 7080498, 7080498, 3993075                 
WER164B  8,864K BYTES OF VIRTUAL STORAGE AVAILABLE, MAX REQUESTED,   
WER164B     0 BYTES RESERVE REQUESTED, 992K BYTES USED               
WER146B  32K BYTES OF EMERGENCY SPACE ALLOCATED                     
WER108I  SORTIN   : RECFM=FB   ; LRECL=  1300; BLKSIZE= 27300       
WER230A  OUTREC   FIELD OUTSIDE RANGE                               
WER211B  SYNCSMF  CALLED BY SYNCSORT; RC=0000                       
WER449I  SYNCSORT GLOBAL DSM SUBSYSTEM ACTIVE                       

Could you please suggest where I am wrong ?
Back to top
View user's profile Send private message
expat

Global Moderator


Joined: 14 Mar 2007
Posts: 8593
Location: Back in jolly old England

PostPosted: Thu Mar 21, 2013 6:41 pm    Post subject:
Reply with quote

Topic moved to the correct home of SYNCSORT topics
Back to top
View user's profile Send private message
Anuj Dhawan

Senior Member


Joined: 22 Apr 2006
Posts: 6258
Location: Mumbai, India

PostPosted: Thu Mar 21, 2013 6:56 pm    Post subject:
Reply with quote

Here is a hint:
Code:
WER230A OUTREC FIELD OUTSIDE RANGE.

And please learn to use BBcode Tags. I've edited it.
Back to top
View user's profile Send private message
sandip_mainframe
Warnings : 2

New User


Joined: 20 Sep 2006
Posts: 61
Location: pune

PostPosted: Thu Mar 21, 2013 7:41 pm    Post subject: Reply to: How to update trailer count
Reply with quote

Hi Anuj,

Sorry for not using BBcodes.

I am not able to find out what length should I provide in PUSH and OVERLAY, I know that it is causing out of range issue in PUSH=(3:1301,9) & OVERLAY=(3:1301,9).


Can you please suggest what value should I provide ?
Back to top
View user's profile Send private message
saiprasadh

Active User


Joined: 20 Sep 2006
Posts: 154
Location: US

PostPosted: Thu Mar 21, 2013 8:28 pm    Post subject:
Reply with quote

Sandip,

In your sort card you are not using the SEQ while forming the group.Please try below mentioned Sort Card.

Code:
 
 SORT FIELDS=COPY                                                       
 OUTREC IFOUTLEN=1300,                                                 
        IFTHEN=(WHEN=GROUP,BEGIN=(1,2,ZD,EQ,10),                       
               END=(1,2,ZD,EQ,90),                                     
               PUSH=(1301:SEQ=9)),                                     
        IFTHEN=(WHEN=(1,2,ZD,EQ,90),                                   
              OVERLAY=(3:1301,9,ZD,ADD,-2,LENGTH=9,EDIT=(TTTTTTTTT)))   

 


Output:

Code:

1000220130320     
20 21400 PUNE     
20 21500 MUMBAI   
20 21600 PUNE     
90000000003       
1000120130320     
20 21700 PUNE     
20 21800 MUMBAI   
20 21900 PUNE     
20 22000 PUNE     
20 23000 PUNE     
20 24000 PUNE     
90000000006       
Back to top
View user's profile Send private message
Bill Woodger

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7233

PostPosted: Fri Mar 22, 2013 4:47 am    Post subject: Reply to: How to update trailer count
Reply with quote

sandip_mainframe,

It is much better to use the full "record code" for your selection.

Your PUSH was copy data to column 3 before anything was put in the source location. As Sai pointed out, what you needed there was to PUSH the SEQ.

From Sai's example, SUB,+2 will work as well, and perhaps will be easier to understand. The tests I tend to make as CH, rather than ZD.
Back to top
View user's profile Send private message
sandip_mainframe
Warnings : 2

New User


Joined: 20 Sep 2006
Posts: 61
Location: pune

PostPosted: Fri Mar 22, 2013 2:06 pm    Post subject: Reply to: How to update trailer count
Reply with quote

Hi Sai/Bill/Anuj,

It's working as per my expectations. Thanks a lot for your time, help and explanations provided.

It's nice to see functionality working.... :-)
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 -> JCL & VSAM All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts -913/-911 Deadlock during UPDATE stat... NoSleep319 DB2 5 Fri Nov 18, 2016 12:37 am
No new posts How to update a portion of text in a ... Bill Woodger DFSORT/ICETOOL 25 Wed Nov 09, 2016 9:41 pm
No new posts Updating Cursor row withour using FOR... chandan.inst DB2 15 Tue Nov 08, 2016 11:17 am
No new posts abend sort based on count records in ... anatol DFSORT/ICETOOL 5 Mon Oct 17, 2016 10:10 pm
No new posts Get Record count in summary record fo... Atul Banke DFSORT/ICETOOL 21 Fri Sep 23, 2016 4:17 pm


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