how to extract variable lenght record depending on a value



IBM's flagship sort product DFSORT for sorting, merging, copying, data manipulation and reporting. Includes ICETOOL and ICEGENER

how to extract variable lenght record depending on a value

Postby stufynice » Mon Sep 17, 2018 2:47 pm

Hi,

I have a VB data set:

in Position (28,3) : i have the lenght of the record that i would like to get * 14

that's to say : if i have the value 004 in position (28,3), i would like to get the record with a lenght of 14*4=56 like (31,56) and the first 20 characters.

here a code in REXX :


/* REXX */
/*TRACE I */
'EXECIO * DISKR ficin (STEM REC. FINIS'
DROPBUF 0
 DO K=1 TO REC.0
   NB_OCC=SUBSTR(REC.K,28,3)
   SAY NB_OCC
   NB_CARAC_TO_WRITE=30+(14*NB_OCC)
   SAY NB_CARAC_TO_WRITE
   DATA_LIGNE=""
   DATA_LIGNE=SUBSTR(REC.K,1,NB_CARAC_TO_WRITE)
   QUEUE DATA_LIGNE
 END
'EXECIO  *  DISKW ficout (FINIS'
 


Can we do that with a JCL step ?

Thank you for your help

Sorry for my english :)

Have a nice day
stufynice
 
Posts: 6
Joined: Mon Sep 17, 2018 1:01 pm
Has thanked: 0 time
Been thanked: 0 time

Re: how to extract variable lenght record depending on a val

Postby NicC » Mon Sep 17, 2018 4:44 pm

Please note the changes I made to your post.

By JCL step I presume you mean "in batch". Yes, you can run your exec in batch. Many examples in the forum.

But why did you post in the DFSort part of the forum? Are you wanting a sort solution?
The problem I have is that people can explain things quickly but I can only comprehend slowly.
Regards
Nic
NicC
Global moderator
 
Posts: 3025
Joined: Sun Jul 04, 2010 12:13 am
Location: Pushing up the daisies (almost)
Has thanked: 4 times
Been thanked: 136 times

Re: how to extract variable lenght record depending on a val

Postby stufynice » Mon Sep 17, 2018 8:46 pm

Hi Nicc,

Yes i would like to do this with a sort solution or other ibm utility without using rexx code.

I really don t know how to do that.

thank you.

Have a nice day
stufynice
 
Posts: 6
Joined: Mon Sep 17, 2018 1:01 pm
Has thanked: 0 time
Been thanked: 0 time

Re: how to extract variable lenght record depending on a val

Postby enrico-sorichetti » Mon Sep 17, 2018 8:58 pm

a sequence of ifthen' s checking the length should do it
the number of variable occurrences will make the writing of the control cards more or less boring :mrgreen:
cheers
enrico
When I tell somebody to RTFM or STFW I usually have the page open in another tab/window of my browser,
so that I am sure that the information requested can be reached with a very small effort
enrico-sorichetti
Global moderator
 
Posts: 2994
Joined: Fri Apr 18, 2008 11:25 pm
Has thanked: 0 time
Been thanked: 164 times

Re: how to extract variable lenght record depending on a val

Postby stufynice » Tue Sep 18, 2018 1:30 pm

hi,

Thank you Enrico, but i think there is a limit about the number of lines in sysin card :)

I think about the parse solution :



//SYSIN    DD *
  OPTION COPY
  OUTREC PARSE=(%01=(FIXLEN=27),
  %02=(FIXLEN=3),
  %03=(FIXLEN=(%02,UFF,MUL,+14,EDIT=(III))), ???????  IT S NOT POSSIBLE TO DO SOMETHING LIKE THAT .....??
  BUILD=(1,4,%01,%02,%03))

 


Thank you for your help.

Have a nice day
stufynice
 
Posts: 6
Joined: Mon Sep 17, 2018 1:01 pm
Has thanked: 0 time
Been thanked: 0 time

Re: how to extract variable lenght record depending on a val

Postby NicC » Tue Sep 18, 2018 3:58 pm

Your data actually starts at the 5th byte because of the RDW so you have to cater for that, both in the input phase and output phase.
The problem I have is that people can explain things quickly but I can only comprehend slowly.
Regards
Nic
NicC
Global moderator
 
Posts: 3025
Joined: Sun Jul 04, 2010 12:13 am
Location: Pushing up the daisies (almost)
Has thanked: 4 times
Been thanked: 136 times

Re: how to extract variable lenght record depending on a val

Postby stufynice » Tue Sep 18, 2018 5:54 pm

do you have an example please ?

I m sorry.

Thanks
stufynice
 
Posts: 6
Joined: Mon Sep 17, 2018 1:01 pm
Has thanked: 0 time
Been thanked: 0 time

Re: how to extract variable lenght record depending on a val

Postby NicC » Tue Sep 18, 2018 9:15 pm

Examples of what? There are plenty of examples in the forum and the manuals bit I am not sure to whom you were referring and what examples.
The problem I have is that people can explain things quickly but I can only comprehend slowly.
Regards
Nic
NicC
Global moderator
 
Posts: 3025
Joined: Sun Jul 04, 2010 12:13 am
Location: Pushing up the daisies (almost)
Has thanked: 4 times
Been thanked: 136 times

Re: how to extract variable lenght record depending on a val

Postby stufynice » Tue Sep 18, 2018 9:54 pm

do you mean that i need to overwrite the RDW in output file with the value in position (27,3) from the input file ???

that s why i asked an example....

I m going to look for it in the forum.

Thank you anyway :)

Have a nice day
stufynice
 
Posts: 6
Joined: Mon Sep 17, 2018 1:01 pm
Has thanked: 0 time
Been thanked: 0 time

Re: how to extract variable lenght record depending on a val

Postby enrico-sorichetti » Tue Sep 18, 2018 11:07 pm

what I meant was something along the lines of ...


 OPTION COPY                                                          
 OUTREC  IFTHEN=(WHEN=(28,3,CH,EQ,C'001'),BUILD=(1,20,031,14)),                                  
         IFTHEN=(WHEN=(28,3,CH,EQ,C'002'),BUILD=(1,20,031,28)),          
         IFTHEN=(WHEN=(28,3,CH,EQ,C'003'),BUILD=(1,20,031,42)),          
         IFTHEN=(WHEN=(28,3,CH,EQ,C'004'),BUILD=(1,20,031,56)),          
         ...
         ...
         ...  
         IFTHEN=(WHEN=(28,3,CH,EQ,C'010'),BUILD=(1,20,31,140)),          
         ...
         ... keep going  
         ...
         IFTHEN=(WHEN=(28,3,CH,EQ,C'100'),BUILD=(1,20,31,1400)),    
         ...      
 


the syntax is certainly wrong, but just to give You an idea of the logic
up to You to straighten things up
cheers
enrico
When I tell somebody to RTFM or STFW I usually have the page open in another tab/window of my browser,
so that I am sure that the information requested can be reached with a very small effort
enrico-sorichetti
Global moderator
 
Posts: 2994
Joined: Fri Apr 18, 2008 11:25 pm
Has thanked: 0 time
Been thanked: 164 times

Next

Return to DFSORT/ICETOOL/ICEGENER

 


  • Related topics
    Replies
    Views
    Last post