Questions

DOS Batch script to Print data to a file only when certain condition exit

Tags:
+
0 Votes
Locked

DOS Batch script to Print data to a file only when certain condition exit

jutpro
I have created the below batch file to search for 4 records (POHEADR, REFID, NAME and LINREF )in all the files in the Orders folder.
I want to print certain fields from these records only when the "NAME NN" record contains the value,
  • +
    0 Votes
    robo_dev

    For debugging purposes, I would sprinkle in some echo statements so you can see if the data is being extracted or not and what your variables are (or are not) getting set to.

    From a variable standpoint NAME NN and NAME TT are the same thing, no? Would the batch file evaluate both of those as 'name'? I could be wrong but, I would be careful about having spaces in variable names in DOS

    Can you do multiple variable evaluations on one pass, or do you need to loop through the file for each evaluation (I don't know batch that well!)

    Do you have to declare and/or reset variables BT and ORD?

    +
    0 Votes
    jutpro

    Thanks for your thoughts. Yes, I did try debugging by using echo statements but still did not receive any results. This tells me I am doing something wrong.

    NAME NN and NAME TT are not variable names they are records in the file. The file has are 3 NAME records.

    I too am not good with batch. Some times I do ok and other times I have to ask for help.

  • +
    0 Votes
    robo_dev

    For debugging purposes, I would sprinkle in some echo statements so you can see if the data is being extracted or not and what your variables are (or are not) getting set to.

    From a variable standpoint NAME NN and NAME TT are the same thing, no? Would the batch file evaluate both of those as 'name'? I could be wrong but, I would be careful about having spaces in variable names in DOS

    Can you do multiple variable evaluations on one pass, or do you need to loop through the file for each evaluation (I don't know batch that well!)

    Do you have to declare and/or reset variables BT and ORD?

    +
    0 Votes
    jutpro

    Thanks for your thoughts. Yes, I did try debugging by using echo statements but still did not receive any results. This tells me I am doing something wrong.

    NAME NN and NAME TT are not variable names they are records in the file. The file has are 3 NAME records.

    I too am not good with batch. Some times I do ok and other times I have to ask for help.